Skip to content

Commit c1e18f8

Browse files
committed
Improve error handling
1 parent 6bad6c2 commit c1e18f8

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

public/partials/anonymize.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ <h1 class="paper-page-title anonymize-topbar-title">
141141

142142
<div class="form-group">
143143
<label class="paper-field-label" for="conference">Conference <span class="paper-optional">(optional)</span></label>
144-
<input class="form-control" id="conference" name="conference" ng-model="conference" ng-class="{'is-invalid': anonymize.conference.$invalid}" />
144+
<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}" />
145145
<small class="form-text text-muted" ng-show="conference_data">
146146
<a ng-href="{{conference_data.url}}" target="_blank">{{conference_data.name}}</a> expires {{conference_data.endDate | date}}.
147147
</small>

public/partials/anonymizePullRequest.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ <h1 class="paper-page-title">Anonymize a <em>pull request</em></h1>
9090
id="conference"
9191
name="conference"
9292
ng-model="conference"
93+
ng-model-options="{ debounce: { default: 800, blur: 0 }, updateOn: 'default blur' }"
9394
ng-class="{'is-invalid': anonymize.conference.$invalid}"
9495
/>
9596
<small class="form-text text-muted" ng-show="conference_data"

public/script/app.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,18 @@ angular
15981598
}
15991599
const selected = $scope.branches.filter((b) => b.name == $scope.source.branch);
16001600
if (selected.length > 0) {
1601-
$scope.source.commit = selected[0].commit;
1601+
// Preserve the saved commit when editing with auto-update off:
1602+
// refreshing branches must not silently bump the pinned SHA to
1603+
// GitHub HEAD. Same intent as the source.branch watcher (#360),
1604+
// extended to cover the branches refresh path.
1605+
const keepSavedCommit =
1606+
$scope.isUpdate &&
1607+
!$scope.options.update &&
1608+
$scope._originalBranch === $scope.source.branch &&
1609+
!!$scope.source.commit;
1610+
if (!keepSavedCommit) {
1611+
$scope.source.commit = selected[0].commit;
1612+
}
16021613
$scope.readme = selected[0].readme;
16031614
await getReadme(force);
16041615
}
@@ -2258,7 +2269,7 @@ angular
22582269
return res.data;
22592270
} catch (err) {
22602271
$scope.type = "error";
2261-
$scope.content = err.data.error;
2272+
$scope.content = (err && err.data && err.data.error) || "unknown_error";
22622273
$scope.files = [];
22632274
}
22642275
};
@@ -2567,6 +2578,10 @@ angular
25672578
for (let i = 0; i < $scope.paths.length; i++) {
25682579
const path = i > 0 ? $scope.paths.slice(0, i).join("/") : "";
25692580
await $scope.getFiles(path);
2581+
if ($scope.type === "error") {
2582+
$scope.$apply();
2583+
return;
2584+
}
25702585
}
25712586
if ($scope.files.length == 1 && $scope.files[0].name == "") {
25722587
$scope.files = [];

public/script/bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)