Make the message optional
This commit is contained in:
@@ -87,7 +87,7 @@ const ModifyMapSettings = ({ open, onClose, onRootClose, mapEnabled }) => {
|
||||
await updateMapEnabled(false);
|
||||
handleClose();
|
||||
} catch (e) {
|
||||
log.error("Error", e);
|
||||
log.error(e);
|
||||
setPhase("failed");
|
||||
}
|
||||
};
|
||||
@@ -98,7 +98,7 @@ const ModifyMapSettings = ({ open, onClose, onRootClose, mapEnabled }) => {
|
||||
await updateMapEnabled(true);
|
||||
handleClose();
|
||||
} catch (e) {
|
||||
log.error("Error", e);
|
||||
log.error(e);
|
||||
setPhase("failed");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -225,7 +225,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
);
|
||||
|
||||
const onGenericError = useCallback((e: unknown) => {
|
||||
log.error("Error", e);
|
||||
log.error(e);
|
||||
showMiniDialog(genericErrorDialogAttributes());
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ export const AttributedMiniDialog: React.FC<
|
||||
await attributes.continue?.action?.();
|
||||
resetPhaseAndClose();
|
||||
} catch (e) {
|
||||
log.error("Error", e);
|
||||
log.error(e);
|
||||
setPhase("failed");
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -65,8 +65,11 @@ const messageWithError = (message: string, e?: unknown) => {
|
||||
return `${message}: ${es}`;
|
||||
};
|
||||
|
||||
const logError = (message: string, e?: unknown) => {
|
||||
const m = `[error] ${messageWithError(message, e)}`;
|
||||
const logError = (message: unknown, e?: unknown) => {
|
||||
const m =
|
||||
typeof message == "string"
|
||||
? `[error] ${messageWithError(message, e)}`
|
||||
: `[error] ${messageWithError("Error", message)}`;
|
||||
console.error(m);
|
||||
if (shouldLogToDisk) logToDisk(m);
|
||||
};
|
||||
@@ -128,6 +131,9 @@ export default {
|
||||
* any arbitrary object that we obtain, say, when in a try-catch handler (in
|
||||
* JavaScript any arbitrary value can be thrown).
|
||||
*
|
||||
* If only one argument is specified, and it is not a string, then it is
|
||||
* taken as the error to be printed, paired with a generic message.
|
||||
*
|
||||
* The log is written to disk and printed to the browser console.
|
||||
*/
|
||||
error: logError,
|
||||
|
||||
Reference in New Issue
Block a user