Skip to content

Commit

Permalink
Add try/catch around example page calls
Browse files Browse the repository at this point in the history
Was causing issue with Mersenne methods
  • Loading branch information
Marak committed Mar 25, 2021
1 parent 149289a commit fac3164
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions examples/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
<td align="right"><input class="fakerButton" type="button" value="' + module + "." + method +'" id="' + inputID + '"/></td>';

// get the default value
var val = faker[module][method]();
var val = '';
try {
val = faker[module][method]();
} catch (err) {
}

// switch input type based on default string / object value being returned
if (typeof val === "object") {
Expand All @@ -72,7 +76,12 @@
var arr = inputID.split('_');
var module = arr[1];
var method = arr[2];
var val = faker[module][method]();
var val = '';
try {
val = faker[module][method]();
} catch (err) {

}
if (typeof val === "object") {
val = JSON.stringify(val, true, 2);
}
Expand Down

0 comments on commit fac3164

Please sign in to comment.