Show error message when the commentlink is configured wrongly
When the 'commentlink.<subsection-name>.match' is configured wrongly, e.g. invalid regular expression, the change screen cannot be loaded, and there is no error message or log. Show an error dialog. Bug: Issue 2514 Change-Id: Ie36fcdb0be13690cacaa64e235a08d7913dea937
This commit is contained in:
parent
6ff6418736
commit
395a49f3ff
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.projects;
|
package com.google.gerrit.client.projects;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.ErrorDialog;
|
||||||
import com.google.gerrit.client.actions.ActionInfo;
|
import com.google.gerrit.client.actions.ActionInfo;
|
||||||
import com.google.gerrit.client.rpc.NativeMap;
|
import com.google.gerrit.client.rpc.NativeMap;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
@ -80,7 +81,16 @@ public class ConfigInfo extends JavaScriptObject {
|
|||||||
if (cl.link() != null) {
|
if (cl.link() != null) {
|
||||||
commentLinks.add(new LinkFindReplace(cl.match(), cl.link()));
|
commentLinks.add(new LinkFindReplace(cl.match(), cl.link()));
|
||||||
} else {
|
} else {
|
||||||
commentLinks.add(new RawFindReplace(cl.match(), cl.html()));
|
try {
|
||||||
|
FindReplace fr = new RawFindReplace(cl.match(), cl.html());
|
||||||
|
commentLinks.add(fr);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
int index = e.getMessage().indexOf("at Object");
|
||||||
|
new ErrorDialog("Invalid commentlink configuration: "
|
||||||
|
+ (index == -1
|
||||||
|
? e.getMessage()
|
||||||
|
: e.getMessage().substring(0, index))).center();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return commentLinks;
|
return commentLinks;
|
||||||
|
Loading…
Reference in New Issue
Block a user