Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6b55107
build(deps-dev): bump @hey-api/openapi-ts from 0.61.3 to 0.66.1
iOvergaard Apr 3, 2025
4d0f64a
docs: adds information on how to configure new fetch-client
iOvergaard Apr 3, 2025
6181682
feat: adds preliminary umb-prefixed error types
iOvergaard Apr 3, 2025
5c13bef
fix: uses correct import path
iOvergaard Apr 3, 2025
b98d06b
docs: jsdocs
iOvergaard Apr 3, 2025
42daeee
feat: optimises error reporting
iOvergaard Apr 3, 2025
b385c5b
feat: maps functions into separate controllers
iOvergaard Apr 3, 2025
50628f2
Merge remote-tracking branch 'origin/v16/dev' into v16/feature/api-re…
iOvergaard Apr 4, 2025
ce47867
feat: adds color to peek notification
iOvergaard Apr 4, 2025
8d51ac6
feat: moves the internal api interceptors controller and adds more in…
iOvergaard Apr 4, 2025
112c9b4
feat: adds host to params
iOvergaard Apr 4, 2025
991a44b
feat: marks certain functions as deprecated
iOvergaard Apr 4, 2025
fbf7084
feat: maps api errors to UmbErrors
iOvergaard Apr 4, 2025
00d5c60
chore: removes deprecation console logs
iOvergaard Apr 4, 2025
d527c2e
chore: allows any
iOvergaard Apr 4, 2025
596f7bf
feat: maps xhr errors to umb errors
iOvergaard Apr 4, 2025
46a6cbe
feat: adds host to tryExecute
iOvergaard Apr 4, 2025
84ecfcc
feat: adjusts deprecation notifices and checks
iOvergaard Apr 4, 2025
0b0d40d
chore: adjusts deprecation notices
iOvergaard Apr 4, 2025
4c8f90c
chore: add .warn() to deprecation
iOvergaard Apr 4, 2025
871fb1a
feat: updates login app repository
iOvergaard Apr 4, 2025
4ac607e
feat: changes all `tryExecuteAndNotify` calls to `tryExecute`
iOvergaard Apr 4, 2025
5caa56b
feat: copies helper functions to resources package and deprecates in …
iOvergaard Apr 4, 2025
78ad5bc
chore: removes unused imports
iOvergaard Apr 4, 2025
55a598a
Merge branch 'v16/dev' into v16/feature/api-resource-controller
iOvergaard Apr 4, 2025
6991ad5
feat: adds exports
iOvergaard Apr 7, 2025
2da122e
chore: removes controller that is no longer useful
iOvergaard Apr 7, 2025
be5b7fb
feat: marks _peekError as protected
iOvergaard Apr 7, 2025
07c0266
feat: adds support for error notifications (and to ignore them) and t…
iOvergaard Apr 7, 2025
dd4574a
feat: eliminates duplicated logic in xhr controller
iOvergaard Apr 7, 2025
86bcfed
feat: touches only the cloned response to allow interceptors downstre…
iOvergaard Apr 7, 2025
09df917
feat: stores the host for async context
iOvergaard Apr 7, 2025
ec44c9d
feat: disables automatic notifications for validation data source
iOvergaard Apr 7, 2025
75db1e6
feat: disables notifications where they are otherwise handled or ignored
iOvergaard Apr 7, 2025
282831c
feat: removes deprecated code
iOvergaard Apr 7, 2025
6c357f6
feat: eliminates a controller that only had a static method
iOvergaard Apr 7, 2025
3c873c3
docs: adds jsdocs
iOvergaard Apr 7, 2025
ec17d9a
docs: adds jsdocs
iOvergaard Apr 7, 2025
6862fd0
docs: adds jsdocs
iOvergaard Apr 7, 2025
b146ffc
feat: returns umb-notifications response without modifying it
iOvergaard Apr 7, 2025
9ebe9c5
feat: eliminates dependency on generated `ProblemDetails` type
iOvergaard Apr 7, 2025
2d1c739
feat: eliminates dependence on generated `ApiError` type
iOvergaard Apr 7, 2025
f928ee5
feat: eliminates dependence on generated `CancelError` type
iOvergaard Apr 7, 2025
0afebda
Merge remote-tracking branch 'origin/v16/dev' into v16/feature/api-re…
iOvergaard Apr 7, 2025
6d1c082
fix: removes dependency on CancelablePromise
iOvergaard Apr 7, 2025
50a228a
fix: resolves an unintended circular reference based on files being m…
iOvergaard Apr 8, 2025
beff453
fix: improves error handling to return early if interceptor does not …
iOvergaard Apr 8, 2025
dfbeebd
Merge remote-tracking branch 'origin/v16/dev' into v16/bugfix/is-noti…
iOvergaard Apr 8, 2025
f30335f
fix: adds try/catch around json parsing
iOvergaard Apr 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import './layouts/default/index.js';
export * from './controllers/peek-error/index.js';
export * from '../resources/extractUmbNotificationColor.function.js';
export * from './isUmbNotifications.function.js';
export * from './notification-handler.js';
export * from './notification.context.js';

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,40 @@ export class UmbApiInterceptorController extends UmbControllerBase {
client.interceptors.response.use(async (response) => {
if (response.ok) return response;

// Clones the response to read the body
const origResponse = response.clone();
const error = await origResponse.json();
if (!error) return response;

// If the error is not an UmbError, we check if it is a problem details object
// Check if the error is a problem details object
if (!('type' in error) || !('title' in error) || !('status' in error)) {
// If not, we just return the response
return response;
}

// Handle 500 errors - we need to show a notification
if (origResponse.status === 500) {
let headline = error.title ?? error.name ?? 'Server Error';
let message = 'A fatal server error occurred. If this continues, please reach out to your administrator.';

// Special handling for ObjectCacheAppCache corruption errors, which we are investigating
if (
error.detail?.includes('ObjectCacheAppCache') ||
error.detail?.includes('Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope()')
) {
headline = 'Please restart the server';
message =
'The Umbraco object cache is corrupt, but your action may still have been executed. Please restart the server to reset the cache. This is a work in progress.';
}
if (response.status === 500) {
try {
// Clones the response to read the body
const origResponse = response.clone();
const error = await origResponse.json();

if (!error) return response;

this.#peekError(headline, message, error.errors ?? error.detail);
// If the error is not an UmbError, we check if it is a problem details object
// Check if the error is a problem details object
if (!('type' in error) || !('title' in error) || !('status' in error)) {
// If not, we just return the response
return response;
}

let headline = error.title ?? error.name ?? 'Server Error';
let message = 'A fatal server error occurred. If this continues, please reach out to your administrator.';

// Special handling for ObjectCacheAppCache corruption errors, which we are investigating
if (
error.detail?.includes('ObjectCacheAppCache') ||
error.detail?.includes('Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope()')
) {
headline = 'Please restart the server';
message =
'The Umbraco object cache is corrupt, but your action may still have been executed. Please restart the server to reset the cache. This is a work in progress.';
}

this.#peekError(headline, message, error.errors ?? error.detail);
} catch (e) {
// Ignore JSON parse error
console.error('[Interceptor] Caught a 500 Error, but failed parsing error body (expected JSON)', e);
}
}

// Return original response
Expand Down
Loading