Skip to content

Commit 4612b4a

Browse files
author
Myztiq
committed
Added logic to handle file too large errors
1 parent fb53a98 commit 4612b4a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

client/directives/activePanel/tabs/editor/directiveFileEditor.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function fileEditor(
1111
debounce,
1212
errs,
1313
keypather,
14-
hasKeypaths,
1514
modelist,
1615
promisify,
1716
loadingPromises
@@ -61,7 +60,11 @@ function fileEditor(
6160
return promisify($scope.file, 'fetch')()
6261
.then(resetFileBodyState)
6362
.catch(function (error) {
64-
$scope.hasError = 'failure';
63+
if (keypather.get(error, 'data.res.statusCode') === 413) {
64+
$scope.hasError = 'tooLarge';
65+
} else {
66+
$scope.hasError = 'failure';
67+
}
6568
errs.report(error);
6669
})
6770
.finally(function () {

client/directives/activePanel/tabs/editor/viewFileEditor.jade

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
)
1010
p.p We're Sorry, but your file is in another castle… and that castle just blew up! 😱
1111

12+
.blank-panel(
13+
ng-if = "!loading && hasError === 'tooLarge'"
14+
)
15+
p.p The requested file is too large to load.
16+
1217
.pre(
1318
lazy-load = "ui.ace"
1419
ng-if = "!hasError && file.attrs.fileType !== 'ssh'"

0 commit comments

Comments
 (0)