Skip to content

I think we need some general exception interface that to make cross platform ErrorMessage for Promise reject #138

@Matrixbirds

Description

@Matrixbirds

Introduction

I'm working on react native module exception design. I need some tool class to help me design more general cross platform error exception which used to be javascript layer. I don't want to write different handlers for different platform so that i looked the react native FileReaderModule.

image

In FileReaderModule, we could see react native team use Promise interface to resolve and reject the result. but there is two different error codes here.

# in objc
NSString *const RCTErrorUnspecified = @"EUNSPECIFIED";

# in java
private static final String ERROR_INVALID_BLOB = "ERROR_INVALID_BLOB";

I think probably we need design more cross platform Promise interface or add a new ExceptionModule for react native Promise interface.

Proposals of ExceptionModule

interface RCTErrorModule {
  code: string,
  description: string
};
promise.reject(new RCTErrorModule(code: "errorCode", description: "description"));

Metadata

Metadata

Assignees

No one assigned

    Labels

    🗣 DiscussionThis label identifies an ongoing discussion on a subject

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions