Skip to content

Commit

Permalink
feat(ses): Shim console groupCollapsed and groupEnd as absent on XS
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Sep 25, 2024
1 parent 7d6a6d0 commit 5e8fd33
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/ses/src/error/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,10 @@ export const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
const levelMethod = (...logArgs) => {
const subErrors = [];
const argTags = extractErrorArgs(logArgs, subErrors);
// eslint-disable-next-line @endo/no-polymorphic-call
baseConsole[level](...argTags);
if (baseConsole[level]) {
// eslint-disable-next-line @endo/no-polymorphic-call
baseConsole[level](...argTags);
}
// @ts-expect-error ConsoleProp vs LogSeverity mismatch
logSubErrors(level, subErrors);
};
Expand Down Expand Up @@ -476,12 +478,16 @@ export const defineCausalConsoleFromLogger = loggedErrorHandler => {
// the host console will separate them with additional spaces.
arrayPush(indents, ' ');
});
} else {
baseConsole[name] = () => {};
}
}
if (baseConsole.groupEnd) {
baseConsole.groupEnd = makeNamed('groupEnd', (...args) => {
arrayPop(indents);
});
} else {
baseConsole.groupEnd = () => {};
}
harden(baseConsole);
const causalConsole = makeCausalConsole(
Expand Down

0 comments on commit 5e8fd33

Please sign in to comment.