Skip to content

Commit

Permalink
Add known error links
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Sep 23, 2023
1 parent 6c004da commit c6c09be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ host.BrowserHost = class {
return this._environment[name];
}

async error(message, detail) {
async error(message, detail /*, cancel */) {
alert((message == 'Error' ? '' : message + ' ') + detail);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions source/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ host.ElectronHost = class {
return this._environment[name];
}

async error(message, detail) {
async error(message, detail, cancel) {
const options = {
type: 'error',
message: message,
detail: detail,
buttons: [ 'Report', 'Cancel' ]
buttons: cancel ? [ 'Report', 'Cancel' ] : [ 'Report' ]
};
return electron.ipcRenderer.sendSync('show-message-box', options);
// return await this._message(message + ': ' + detail, 'Report');
Expand Down
11 changes: 6 additions & 5 deletions source/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,23 @@ view.View = class {
{ name: 'Error loading model.', message: /^Unsupported Protocol Buffers text content/, url: 'https://github.com/lutzroeder/netron/issues/594' },
{ name: 'Error loading model.', message: /^Unsupported JSON content/, url: 'https://github.com/lutzroeder/netron/issues/595' },
{ name: 'Error loading Caffe model.', message: /^File format is not caffe\.NetParameter/, url: 'https://github.com/lutzroeder/netron/issues/563' },
{ name: 'Error loading Darknet model.', message: /^Invalid tensor shape/, url: 'https://github.com/lutzroeder/netron/issues/541' },
{ name: 'Error loading DaVinci model.', message: /^Unsupported attribute type/, url: 'https://github.com/lutzroeder/netron/issues/926' },
{ name: 'Error loading DaVinci OM model.', message: /^Unsupported DaVinci OM partition type\./, url: 'https://github.com/lutzroeder/netron/issues/1154' },
{ name: 'Error loading MNN model.', message: /^File format is not mnn\.Net/, url: 'https://github.com/lutzroeder/netron/issues/746' },
{ name: 'Error loading NNEF model.', message: /^.*/, url: 'https://github.com/lutzroeder/netron/issues/992' },
{ name: 'Error loading PyTorch model.', message: /^File does not contain root module or state dictionary/, url: 'https://github.com/lutzroeder/netron/issues/543' },
{ name: 'Error loading PyTorch model.', message: /^Module does not contain modules/, url: 'https://github.com/lutzroeder/netron/issues/544' },
{ name: 'Error loading PyTorch model.', message: /^Unknown type name/, url: 'https://github.com/lutzroeder/netron/issues/969' },
{ name: 'Error loading ONNX model.', message: /^File format is not onnx\.ModelProto \(Unexpected end of file\)\./, url: 'https://github.com/lutzroeder/netron/issues/1155' },
{ name: 'Error loading ONNX model.', message: /^File format is not onnx\.ModelProto \(Cannot read properties of undefined \(reading 'ModelProto'\)\)\./, url: 'https://github.com/lutzroeder/netron/issues/1156' },
{ name: 'Error loading ONNX model.', message: /^File format is not onnx\.ModelProto/, url: 'https://github.com/lutzroeder/netron/issues/549' },
{ name: 'Error loading TensorFlow Lite model.', message: /^Offset is outside the bounds of the DataView/, url: 'https://github.com/lutzroeder/netron/issues/563' },
{ name: 'Error loading TensorRT model.', message: /^Invalid file content. File contains undocumented TensorRT engine data\./, url: 'https://github.com/lutzroeder/netron/issues/725' }
{ name: 'Error loading TensorRT model.', message: /^Invalid file content. File contains undocumented TensorRT engine data\./, url: 'https://github.com/lutzroeder/netron/issues/725' },
];
const known = knowns.find((known) => (known.name.length === 0 || known.name === err.name) && err.message.match(known.message));
const url = known && known.url ? known.url : null;
const message = err.message;
name = name || err.name;
const button = await this._host.error(name, message);
const url = known && known.url ? known.url : null;
const button = await this._host.error(name, message, url === null);
if (button === 0 && (url || this._host.type == 'Electron')) {
this._host.openURL(url || this._host.environment('repository') + '/issues');
}
Expand Down

0 comments on commit c6c09be

Please sign in to comment.