fix(communities): allow actual import errors to come through
This commit enures we render proper errors during an import, even if we've reached the maximum of warning/error items to render.
This commit is contained in:
parent
8115fdd0d0
commit
f87f952330
|
@ -43,7 +43,7 @@ proc initDiscordImportTaskItem*(
|
|||
# We only show the first 3 errors per task, then we add another
|
||||
# "#n more issues" item in the UI
|
||||
for i, error in errors:
|
||||
if i < MAX_VISIBLE_ERROR_ITEMS:
|
||||
if i < MAX_VISIBLE_ERROR_ITEMS or error.code > ord(DiscordImportErrorCode.Warning):
|
||||
result.errors.addItem(initDiscordImportErrorItem(`type`, error.code, error.message))
|
||||
|
||||
proc getType*(self: DiscordImportTaskItem): string =
|
||||
|
|
|
@ -102,10 +102,10 @@ QtObject:
|
|||
|
||||
let errorItemsCount = self.items[idx].errors.items.len
|
||||
|
||||
# We only show the first 3 errors per task, then we add another
|
||||
# "#n more issues" item in the UI
|
||||
# We only show the first 3 warnings + any error per task,
|
||||
# then we add another "#n more issues" item in the UI
|
||||
for i, error in item.errors:
|
||||
if errorItemsCount + i < taskItem.MAX_VISIBLE_ERROR_ITEMS:
|
||||
if (errorItemsCount + i < taskItem.MAX_VISIBLE_ERROR_ITEMS) or error.code > ord(DiscordImportErrorCode.Warning):
|
||||
let errorItem = initDiscordImportErrorItem(item.`type`, error.code, error.message)
|
||||
self.items[idx].errors.addItem(errorItem)
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ type DiscordChannelDto* = object
|
|||
filePath*: string
|
||||
|
||||
type DiscordImportErrorCode* {.pure.}= enum
|
||||
Unknown = 0,
|
||||
Warning = 1,
|
||||
Error = 2
|
||||
Unknown = 1,
|
||||
Warning = 2,
|
||||
Error = 3
|
||||
|
||||
type DiscordImportError* = object
|
||||
code*: int
|
||||
|
|
Loading…
Reference in New Issue