11import { createTransport } from '@sentry/core' ;
22import type { BaseTransportOptions , Transport , TransportMakeRequestResponse , TransportRequest } from '@sentry/types' ;
3- import { consoleSandbox , rejectedSyncPromise } from '@sentry/utils' ;
3+ import { consoleSandbox , logger , rejectedSyncPromise } from '@sentry/utils' ;
44
55export interface DenoTransportOptions extends BaseTransportOptions {
66 /** Custom headers for the transport. Used by the XHRTransport and FetchTransport */
@@ -13,13 +13,20 @@ export interface DenoTransportOptions extends BaseTransportOptions {
1313export function makeFetchTransport ( options : DenoTransportOptions ) : Transport {
1414 const url = new URL ( options . url ) ;
1515
16- if ( Deno . permissions . querySync ( { name : 'net' , host : url . host } ) . state !== 'granted' ) {
17- consoleSandbox ( ( ) => {
18- // eslint-disable-next-line no-console
19- console . warn ( `Sentry SDK requires 'net' permission to send events.
20- Run with '--allow-net=${ url . host } ' to grant the requires permissions.` ) ;
16+ Deno . permissions
17+ . query ( { name : 'net' , host : url . host } )
18+ . then ( ( { state } ) => {
19+ if ( state !== 'granted' ) {
20+ consoleSandbox ( ( ) => {
21+ // eslint-disable-next-line no-console
22+ console . warn ( `Sentry SDK requires 'net' permission to send events.
23+ Run with '--allow-net=${ url . host } ' to grant the requires permissions.` ) ;
24+ } ) ;
25+ }
26+ } )
27+ . catch ( ( ) => {
28+ logger . warn ( 'Failed to read the "net" permission.' ) ;
2129 } ) ;
22- }
2330
2431 function makeRequest ( request : TransportRequest ) : PromiseLike < TransportMakeRequestResponse > {
2532 const requestOptions : RequestInit = {
0 commit comments