Files
explore/lib/errors/getResourceErrorPayload.tsx
tom goriunovandGitHub 4ed3447741 customize scroll bar in snippets (#1053)
* custom styles for scrollbar

* style scrollbar for search suggest on home page

* change overflow for search suggest

* fix error screen when API error payload is string

e.g. "Internal server error"

* add resizer img and styles for FF

* update screenshots

* update icon for dark theme
2023-08-07 15:39:24 -04:00

10 lines
413 B
TypeScript

import type { ResourceError } from 'lib/api/resources';
import getErrorCause from './getErrorCause';
export default function getResourceErrorPayload<Payload = Record<string, unknown> | string>(error: Error | undefined):
ResourceError<Payload>['payload'] | undefined {
const cause = getErrorCause(error);
return cause && 'payload' in cause ? cause.payload as ResourceError<Payload>['payload'] : undefined;
}