This repository was archived by the owner on Jul 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export const AppAlert = () => {
3737 updateAlert ( ) ;
3838 } , [ alertSourceUrl ] ) ;
3939
40- if ( ! alert || ! alert . enabled ) {
40+ if ( ! alertSourceUrl || ! alert || ! alert . enabled ) {
4141 return null ;
4242 }
4343
Original file line number Diff line number Diff line change 1+ import { debugConsole } from '../helpers/console-log' ;
2+
13export type ModManagerAlert = {
24 enabled : boolean ;
35 message : string ;
46} ;
57
68export async function getModManagerAlert (
7- url : string
9+ url : string ,
810) : Promise < ModManagerAlert > {
9- const response = await fetch ( url ) ;
11+ try {
12+ const response = await fetch ( url ) ;
1013
11- if ( ! response . ok ) {
12- throw new Error ( `${ response . statusText } (${ response . status } )` ) ;
13- }
14+ if ( ! response . ok ) {
15+ throw new Error ( `${ response . statusText } (${ response . status } )` ) ;
16+ }
1417
15- return ( await response . json ( ) ) as ModManagerAlert ;
18+ return ( await response . json ( ) ) as ModManagerAlert ;
19+ } catch ( error ) {
20+ debugConsole . error ( `Failed to get alert: ${ error } ` ) ;
21+ return { enabled : false , message : '' } ;
22+ }
1623}
You can’t perform that action at this time.
0 commit comments