-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ntp: matching designs for customizer drawer * re-enable tests
- Loading branch information
1 parent
4c6371f
commit ac1518c
Showing
36 changed files
with
776 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { h } from 'preact'; | ||
import { ErrorBoundary } from '../../../shared/components/ErrorBoundary.js'; | ||
import { useMessaging } from './types.js'; | ||
|
||
/** | ||
* @param {object} props | ||
* @param {import("preact").ComponentChild} props.children | ||
* @param {string} props.named | ||
* @param {(message: string) => import("preact").ComponentChild} [props.fallback] | ||
*/ | ||
export function InlineError({ children, named, fallback }) { | ||
const messaging = useMessaging(); | ||
/** | ||
* @param {any} error | ||
* @param {string} id | ||
*/ | ||
const didCatch = (error, id) => { | ||
const message = error?.message || error?.error || 'unknown'; | ||
const composed = `Customizer section '${id}' threw an exception: ` + message; | ||
messaging.reportPageException({ message: composed }); | ||
}; | ||
const inlineMessage = 'A problem occurred with this feature. DuckDuckGo was notified'; | ||
const fallbackElement = fallback?.(inlineMessage) || <p>{inlineMessage}</p>; | ||
return ( | ||
<ErrorBoundary didCatch={(error) => didCatch(error, named)} fallback={fallbackElement}> | ||
{children} | ||
</ErrorBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.