Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add filterRuntimeDevErrors config property #527

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

aralroca
Copy link
Collaborator

@aralroca aralroca commented Oct 7, 2024

Fixes #515

Proposal by @enzonotario , already applied to the www project to ignore the Monaco Editor error about ResizeError

Filter Runtime Development Errors

The filterRuntimeDevErrors configuration property in brisa.config.ts allows you to filter runtime development errors. This is useful for filtering out errors that are not relevant to your application.

Example

In the next example, we are filtering out the TypeError error. This means that the error will not be logged to the console.

brisa.config.ts:

import type { Configuration } from "brisa";

export default {
  filterRuntimeDevErrors(error: ErrorEvent) {
    return !(error.error instanceof TypeError);
  },
} satisfies Configuration;

Important

This config property is stringified and passed to the client code only during development, so it should not have any side effects.

Types

export type Configuration = {
  // ...
  filterRuntimeDevErrors?(error: ErrorEvent): boolean;
};

@aralroca aralroca merged commit 71a374d into main Oct 7, 2024
3 of 6 checks passed
@aralroca aralroca deleted the aralroca/filter-dev-logs branch October 7, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow to disable some dev errors to avoid modal disturbance
1 participant