Skip to content

Improve error message when Subscription internal SendEvent throws exception #33

@ssanabriacec

Description

@ssanabriacec

Expected behavior:

When mapping two types on the EventManagerController if it fails it should show an Exception message error on the IDE

Error description:

The application fails silently showing just a skimpy message error with a false string message

Steps to reproduce:

The idea here is just to convert from one type to another that doesn't exists, so mapping any type to another should work.

  • On the EventManagerController create a RegisterLocal and the callback function with the mapping designed to fail

EventDispatcher.RegisterLocal("my_event", OnMyEvent);

private HttpResponseMessage OnMyEvent(Event e){
List types= mapper.Map<List>(otherTypeData);
}

  • Within Postman, send the an event:
{
    "Name": "my_event",
    "Payload": [
        {
            "Id": "03079909-8572-479d-9261-aab473987ba5",
        }
    ],
    "Timestamp": "2020-10-27 13:12:49",
    "ExtraParams": {
        "name": "value"
    },
    "IsExternal": "true"
}

Check for error message similar to this on the application:

Queue.ProcessItem, Sending Item back to queue - Item ID:

Possible fix:

  • Send the exception message in the serialized string instead of just false (ex.Message + ex.StackTrace)
  • Throw an exception specifically for mapping (catch just that error) so the code actually fails on the main application, and send a string for anything else. Mapping errors should be discovered during development Note: wondering if we should fire the error at all because if the json payload is different for any reason during the running of the application, then it would make it crash

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions