mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
surface detail field for 403 errors
This commit is contained in:
parent
1809990ed4
commit
853c83d0c2
@ -384,6 +384,13 @@ export const systemSlice = createSlice({
|
||||
state.statusTranslationKey = 'common.statusPreparing';
|
||||
});
|
||||
|
||||
builder.addCase(sessionInvoked.rejected, (state, action) => {
|
||||
const error = action.payload as string | undefined;
|
||||
state.toastQueue.push(
|
||||
makeToast({ title: error || t('toast.serverError'), status: 'error' })
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Session Canceled
|
||||
*/
|
||||
|
@ -101,17 +101,24 @@ export const nodeAdded = createAppAsyncThunk(
|
||||
*/
|
||||
export const sessionInvoked = createAppAsyncThunk(
|
||||
'api/sessionInvoked',
|
||||
async (arg: { sessionId: string }, _thunkApi) => {
|
||||
async (arg: { sessionId: string }, { rejectWithValue }) => {
|
||||
const { sessionId } = arg;
|
||||
|
||||
try {
|
||||
const response = await SessionsService.invokeSession({
|
||||
sessionId,
|
||||
all: true,
|
||||
});
|
||||
|
||||
sessionLog.info({ arg, response }, `Session invoked (${sessionId})`);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
const err = error as any;
|
||||
if (err.status === 403) {
|
||||
return rejectWithValue(err.body.detail);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user