Improve error handling

This commit is contained in:
tdurieux
2026-05-06 17:39:43 +03:00
parent 6bad6c2f09
commit c1e18f82a9
4 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -141,7 +141,7 @@
<div class="form-group"> <div class="form-group">
<label class="paper-field-label" for="conference">Conference <span class="paper-optional">(optional)</span></label> <label class="paper-field-label" for="conference">Conference <span class="paper-optional">(optional)</span></label>
<input class="form-control" id="conference" name="conference" ng-model="conference" ng-class="{'is-invalid': anonymize.conference.$invalid}" /> <input class="form-control" id="conference" name="conference" ng-model="conference" ng-model-options="{ debounce: { default: 800, blur: 0 }, updateOn: 'default blur' }" ng-class="{'is-invalid': anonymize.conference.$invalid}" />
<small class="form-text text-muted" ng-show="conference_data"> <small class="form-text text-muted" ng-show="conference_data">
<a ng-href="{{conference_data.url}}" target="_blank">{{conference_data.name}}</a> expires {{conference_data.endDate | date}}. <a ng-href="{{conference_data.url}}" target="_blank">{{conference_data.name}}</a> expires {{conference_data.endDate | date}}.
</small> </small>
+1
View File
@@ -90,6 +90,7 @@
id="conference" id="conference"
name="conference" name="conference"
ng-model="conference" ng-model="conference"
ng-model-options="{ debounce: { default: 800, blur: 0 }, updateOn: 'default blur' }"
ng-class="{'is-invalid': anonymize.conference.$invalid}" ng-class="{'is-invalid': anonymize.conference.$invalid}"
/> />
<small class="form-text text-muted" ng-show="conference_data" <small class="form-text text-muted" ng-show="conference_data"
+17 -2
View File
@@ -1598,7 +1598,18 @@ angular
} }
const selected = $scope.branches.filter((b) => b.name == $scope.source.branch); const selected = $scope.branches.filter((b) => b.name == $scope.source.branch);
if (selected.length > 0) { if (selected.length > 0) {
$scope.source.commit = selected[0].commit; // Preserve the saved commit when editing with auto-update off:
// refreshing branches must not silently bump the pinned SHA to
// GitHub HEAD. Same intent as the source.branch watcher (#360),
// extended to cover the branches refresh path.
const keepSavedCommit =
$scope.isUpdate &&
!$scope.options.update &&
$scope._originalBranch === $scope.source.branch &&
!!$scope.source.commit;
if (!keepSavedCommit) {
$scope.source.commit = selected[0].commit;
}
$scope.readme = selected[0].readme; $scope.readme = selected[0].readme;
await getReadme(force); await getReadme(force);
} }
@@ -2258,7 +2269,7 @@ angular
return res.data; return res.data;
} catch (err) { } catch (err) {
$scope.type = "error"; $scope.type = "error";
$scope.content = err.data.error; $scope.content = (err && err.data && err.data.error) || "unknown_error";
$scope.files = []; $scope.files = [];
} }
}; };
@@ -2567,6 +2578,10 @@ angular
for (let i = 0; i < $scope.paths.length; i++) { for (let i = 0; i < $scope.paths.length; i++) {
const path = i > 0 ? $scope.paths.slice(0, i).join("/") : ""; const path = i > 0 ? $scope.paths.slice(0, i).join("/") : "";
await $scope.getFiles(path); await $scope.getFiles(path);
if ($scope.type === "error") {
$scope.$apply();
return;
}
} }
if ($scope.files.length == 1 && $scope.files[0].name == "") { if ($scope.files.length == 1 && $scope.files[0].name == "") {
$scope.files = []; $scope.files = [];
+1 -1
View File
File diff suppressed because one or more lines are too long