File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { NfFetchException } from "../exception/exceptions/fetch.exception" ;
2+
13export class NfFile {
24 private readonly _path : string ;
35
@@ -41,7 +43,7 @@ export class NfFile {
4143
4244 private async _fetch ( ) : Promise < Response > {
4345 const res = await fetch ( this . _path ) ;
44- if ( ! res . ok ) throw new Error ( ` ${ res . status } ${ res . statusText } ` ) ;
46+ if ( ! res . ok ) throw new NfFetchException ( res . status , res . statusText ) ;
4547 return res ;
4648 }
4749}
Original file line number Diff line number Diff line change 1+ import { NfException } from "../abstracts/exception.abstract" ;
2+
3+ export class NfFetchException extends NfException {
4+ private readonly _code : number ;
5+
6+ get code ( ) : number {
7+ return this . _code ;
8+ }
9+
10+ constructor ( code : number , text : string ) {
11+ super ( `Fetch exception : ${ code } - ${ text } ` ) ;
12+ this . _code = code ;
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments