fix: adjust error codes for discord import
There are two types of errors "non-critical" (or "warning") and "critical". These map to error codes `1` and `2` respectively. The current error codes are a left-over of initial experimenting.
This commit is contained in:
parent
cd91b19737
commit
eda6d10ce5
|
@ -1801,7 +1801,7 @@ func (m *Messenger) ExtractDiscordDataFromImportFiles(filesToImport []string) (*
|
||||||
bytes, err := os.ReadFile(filePath)
|
bytes, err := os.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors[fileToImport] = &discord.ImportError{
|
errors[fileToImport] = &discord.ImportError{
|
||||||
Code: 201,
|
Code: 2,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
|
@ -1812,7 +1812,7 @@ func (m *Messenger) ExtractDiscordDataFromImportFiles(filesToImport []string) (*
|
||||||
err = json.Unmarshal(bytes, &discordExportedData)
|
err = json.Unmarshal(bytes, &discordExportedData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors[fileToImport] = &discord.ImportError{
|
errors[fileToImport] = &discord.ImportError{
|
||||||
Code: 202,
|
Code: 2,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
|
@ -1820,7 +1820,7 @@ func (m *Messenger) ExtractDiscordDataFromImportFiles(filesToImport []string) (*
|
||||||
|
|
||||||
if len(discordExportedData.Messages) == 0 {
|
if len(discordExportedData.Messages) == 0 {
|
||||||
errors[fileToImport] = &discord.ImportError{
|
errors[fileToImport] = &discord.ImportError{
|
||||||
Code: 203,
|
Code: 2,
|
||||||
Message: "No messages to import",
|
Message: "No messages to import",
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue