File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,10 @@ export function createParams(
420420 try {
421421 pgEnv = getPgEnv ( ) ;
422422 } catch ( e ) {
423- if ( e instanceof Deno . errors . PermissionDenied ) {
423+ // In Deno v1, Deno permission errors resulted in a Deno.errors.PermissionDenied exception. In Deno v2, a new
424+ // Deno.errors.NotCapable exception was added to replace this. The "in" check makes this code safe for both Deno
425+ // 1 and Deno 2
426+ if ( e instanceof Deno . errors . PermissionDenied || ( 'NotCapable' in Deno . errors && e instanceof Deno . errors . NotCapable ) ) {
424427 has_env_access = false ;
425428 } else {
426429 throw e ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ let DEV_MODE: string | undefined;
1515try {
1616 DEV_MODE = Deno . env . get ( "DENO_POSTGRES_DEVELOPMENT" ) ;
1717} catch ( e ) {
18- if ( e instanceof Deno . errors . PermissionDenied ) {
18+ if ( e instanceof Deno . errors . PermissionDenied || ( 'NotCapable' in Deno . errors && e instanceof Deno . errors . NotCapable ) ) {
1919 throw new Error (
2020 "You need to provide ENV access in order to run the test suite" ,
2121 ) ;
You can’t perform that action at this time.
0 commit comments