Few more changes
This commit is contained in:
parent
db97974ed0
commit
0179a6f3af
|
|
@ -1,15 +1,3 @@
|
|||
export const DEFAULT_ERROR_MESSAGE = "There was an error";
|
||||
export const DEFAULT_ACTION_ERROR = (action: string) =>
|
||||
`Incurred an error when ${action}`;
|
||||
|
||||
export const API_ERROR_CODES = [
|
||||
1000,
|
||||
4000,
|
||||
4001,
|
||||
4002,
|
||||
4003,
|
||||
4004,
|
||||
4006,
|
||||
5000,
|
||||
5001,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,6 +3,5 @@ import { Position, Toaster } from "@blueprintjs/core";
|
|||
// To add a toast import this instance and call .show()
|
||||
// https://blueprintjs.com/docs/#core/components/toast.example
|
||||
export default Toaster.create({
|
||||
className: "toaster",
|
||||
position: Position.BOTTOM_RIGHT,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ export function* validateResponse(response: ApiResponse) {
|
|||
}
|
||||
}
|
||||
|
||||
type IError = object | { message: string };
|
||||
type ErrorPayloadType = object | { message: string };
|
||||
|
||||
const ActionErrorDisplayMap: {
|
||||
[key: string]: (error: IError) => string;
|
||||
[key: string]: (error: ErrorPayloadType) => string;
|
||||
} = {
|
||||
[ReduxActionErrorTypes.API_ERROR]: error =>
|
||||
_.get(error, "message", DEFAULT_ERROR_MESSAGE),
|
||||
|
|
@ -42,7 +42,9 @@ const ActionErrorDisplayMap: {
|
|||
[ReduxActionErrorTypes.WIDGET_OPERATION_ERROR]: () => DEFAULT_ERROR_MESSAGE,
|
||||
};
|
||||
|
||||
export function* errorSaga(errorAction: ReduxAction<{ error: IError }>) {
|
||||
export function* errorSaga(
|
||||
errorAction: ReduxAction<{ error: ErrorPayloadType }>,
|
||||
) {
|
||||
// Just a pass through for now.
|
||||
// Add procedures to customize errors here
|
||||
console.log({ error: errorAction });
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user