Skip to content

Commit

Permalink
handle 404 when openning files
Browse files Browse the repository at this point in the history
Signed-off-by: hamza221 <hamzamahjoubi221@gmail.com>
  • Loading branch information
hamza221 committed Feb 7, 2023
1 parent e61306f commit f7b2559
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,13 @@ export default {
console.debug('File info for ' + path + ' fetched', fileInfo)
await this.openFileInfo(fileInfo, overrideHandlerId)
} catch (error) {
console.error('Could not open file ' + path, error)
if (error?.response?.status === 404) {
logger.error('The file no longer exists, error: ', { error })
showError(t('viewer', 'This file no longer exists'))
this.close()
} else {
console.error('Could not open file ' + path, error)
}
}
},

Expand Down

0 comments on commit f7b2559

Please sign in to comment.