1
1
import { createTransport } from '@sentry/core' ;
2
2
import type { BaseTransportOptions , Transport , TransportMakeRequestResponse , TransportRequest } from '@sentry/types' ;
3
- import { consoleSandbox , rejectedSyncPromise } from '@sentry/utils' ;
3
+ import { consoleSandbox , logger , rejectedSyncPromise } from '@sentry/utils' ;
4
4
5
5
export interface DenoTransportOptions extends BaseTransportOptions {
6
6
/** Custom headers for the transport. Used by the XHRTransport and FetchTransport */
@@ -13,13 +13,20 @@ export interface DenoTransportOptions extends BaseTransportOptions {
13
13
export function makeFetchTransport ( options : DenoTransportOptions ) : Transport {
14
14
const url = new URL ( options . url ) ;
15
15
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.' ) ;
21
29
} ) ;
22
- }
23
30
24
31
function makeRequest ( request : TransportRequest ) : PromiseLike < TransportMakeRequestResponse > {
25
32
const requestOptions : RequestInit = {
0 commit comments