js-sdk icon indicating copy to clipboard operation
js-sdk copied to clipboard

Cleanup: Create custom method unsupported errors

Open shubham1172 opened this issue 2 years ago • 2 comments

Describe the proposal

Today we find multiple instances of these in our codebase:

async subscribe(_storeName: string, _cb: SubscribeConfigurationCallback): Promise<SubscribeConfigurationStream> {
    throw new Error('HTTP is currently not supported.');
}

getRegisteredActors(): Promise<string[]> {
  throw new Error('GRPC is currently not supported.');
}

This proposal is to create two custom Errors: HttpNotSupportedError and GrpcNotSupportedError which can be reused in our code.

shubham1172 avatar Jun 13 '22 05:06 shubham1172

Hello @shubham1172 I'm new to contributing to open source, i came across this project after a while of searching and i would love to take on this issue. could you give me any pointers on how to go about it?? what file would i have to modify or what folder to create a new file for the custom error. Thank you and kind regards.

jriffs avatar Jun 03 '23 18:06 jriffs

Hi @jriffs, welcome to this project 😊

I would probably add a new errors dir here https://github.com/dapr/js-sdk/tree/main/src/types and create custom error classes, and then replace HTTP/gRPC is not supported errors in the codebase with these types. Please feel free to create a draft PR and then we can discuss more implementation details there.

shubham1172 avatar Jun 05 '23 18:06 shubham1172