Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not deserialize exception of dependency service #3

Open
pootow opened this issue Sep 26, 2016 · 1 comment
Open

Can not deserialize exception of dependency service #3

pootow opened this issue Sep 26, 2016 · 1 comment
Labels

Comments

@pootow
Copy link
Member

pootow commented Sep 26, 2016

When I calling service A, and A is calling service B, service B throws an exception of , for example. And service A can not handle this exception, the exception is thrown to me, but I don't have service B's jar at my class path, then this client SDK will throw an exception at ExceptionUtils class.

This is not a desired behavior. Maybe we should create a GenericServiceException for this case.

class GenericServiceException extends Exception {
    public Map<?,?> detail
}
@pootow pootow added the bug label Sep 26, 2016
@mengqiang81
Copy link
Contributor

mengqiang81 commented Sep 26, 2016

Yes, it is an known issue.

With this method:

public static Throwable getThrowableInstance(ExceptionMessage exceptionMessage) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
    Class<?> cl = Class.forName(exceptionMessage.getName());
    Class[] params = {String.class};
    Constructor constructor = cl.getConstructor(params);
    return (Throwable) constructor.newInstance(new Object[]{exceptionMessage.getMsg()});
}

It is too simple, not only the question you mentioned but also we lost the cause information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants