googleapis / nodejs-storage

Node.js client for Google Cloud Storage: unified object storage for developers and enterprises, from live data serving to data analytics/ML to data archiving.
https://cloud.google.com/storage/
Apache License 2.0
898 stars 370 forks source link

Cannot import RETRYABLE_ERR_FN_DEFAULT #2516

Closed Cynocracy closed 1 month ago

Cynocracy commented 2 months ago

Is your feature request related to a problem? Please describe. I want to import RETRYABLE_ERR_FN_DEFAULT to be able to customize it Describe the solution you'd like export RETRYABLE_ERR_FN_DEFAULT Describe alternatives you've considered Copying the code into my repo is my current option, but this will drift from upstream over time, and hurts Google's ability to provide good service through GCS to nodejs consumers, imo. Additional context

ddelgrosso1 commented 1 month ago

Hi @Cynocracy

The function is already customizable by passing a function here:

https://github.com/googleapis/nodejs-storage/blob/main/src/storage.ts#L76-#L84

Which can be passed to the Storage constructor here:

https://github.com/googleapis/nodejs-storage/blob/57b28f1123db414c545bc0c1b0a760cf57aa2cb0/src/storage.ts#L100

Is there another reason you want to have the default exported?

Cynocracy commented 1 month ago

@ddelgrosso1 I want to customize the default with

retryableErrorFn: (error) => {
    const original = RETRYABLE_ERR_FN_DEFAULT(error);
    // log the error
    return original;      
}

if the default is not exported, I would have to reimplement it