Skip to main content
deleted 96 characters in body
Source Link
Mike Nakis
  • 32.7k
  • 7
  • 80
  • 116

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, if the processing of the event results in a state change, then it will issue a state change event to all registered observers, but that's a different issue.) This response to the requesting client should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually plays the role of a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, if the processing of the event results in a state change, then it will issue a state change event to all registered observers, but that's a different issue.) This response to the requesting client should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually plays the role of a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, if the processing of the event results in a state change, then it will issue a state change event to all registered observers, but that's a different issue.) This response to the requesting client should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually plays the role of a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me.

added 62 characters in body
Source Link
Mike Nakis
  • 32.7k
  • 7
  • 80
  • 116

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, if the processing of the event results in a state change, then it will issue a state change event forto all registered observers, but that's a different issue.) This response to the requesting client should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually acts asplays the role of a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, it will issue a state change event for all registered observers, but that's a different issue.) This response should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually acts as a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, if the processing of the event results in a state change, then it will issue a state change event to all registered observers, but that's a different issue.) This response to the requesting client should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually plays the role of a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

added 114 characters in body
Source Link
Mike Nakis
  • 32.7k
  • 7
  • 80
  • 116

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to thethat client which sent the original request, and only to that one client. The (Additionally, it will issue a state change event for all registered observers, but that's a different issue.) This response should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually acts as a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to the client which sent the original request, and only to that one client. The response should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually acts as a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

From a purely theoretical standpoint, (irrespective of the particular situation that you have at hand,) an event signifies a state transition of a system. Now, if an error occurs during the processing of a request, then ideally, the system should have a built-in rollback mechanism, so no state transition should occur, therefore, no event should be issued. If, nonetheless, a state transition does occur, then an event should of course be issued, but it should only contain information about the state transition. Error information does not fit into this picture; it is irrelevant. Observers of events expect to be notified about transitions so as to take appropriate action, they have no use and no interest in knowing anything whatsoever about errors.

Now, all that is completely unrelated to the response of a request. When a client sends a request, the server sends back a response to that client, and only to that one client. (Additionally, it will issue a state change event for all registered observers, but that's a different issue.) This response should, of course, contain error information in case of failure. The fact that you are using an event mechanism to implement your responses is completely irrelevant, and actually acts as a red herring in this discussion. So, including an actual exception object within a response seems perfectly legit to me. That's precisely the reason why exceptions were invented: to free us from having to use enums.

Source Link
Mike Nakis
  • 32.7k
  • 7
  • 80
  • 116
Loading