2016-11-21 23-23-05
Gonçalo Borrêga
Allow custom Exceptions to be public and referenced from other espaces
5053
Views
66
Comments
On our RadarOn our Radar
Backend
Just as all other elements, the custom exception could be public so that on consumer espaces you can have error handling for specific custom exceptions of the producer espaces.

Showing what kind of exceptions are thrown in the tooltip of a user action would also be a good improvement
2016-04-21 20-09-55
J.
Ā 
MVP

I want this feature very much, because you want to bubble exceptions a through other espaces as well and handle them there accordingly.
It would be nice if we could define a user exception in one eSpace and use it across the factory without having to redfine them.

Merged from 'Allow user exceptions to be referenced between eSpaces' (idea created on 2011-09-01 15:52:56 by AndrĆ© Ramos), on 2014-01-24 13:26:05 by GonƧalo BorrĆŖga
I'd like for Exceptions to be public so they can be re-used. A few reasons:

1. We keep re-making the same exceptions over and over again.
2. Can handle exceptions from a Produce eSpace in a granular fashion in the Consumer eSpace.

J.Ja


Merged from 'Allow Exceptions to be public' (idea created on 2014-09-01 18:34:20 by Justin James), on 2014-09-23 23:26:46 by GonƧalo BorrĆŖga
It would be definitely useful!

Merged from 'Allow Exceptions to be public' (idea created on 2014-09-01 18:34:20 by Justin James), on 2014-09-23 23:26:46 by GonƧalo BorrĆŖga
2016-04-21 20-09-55
J.
Ā 
MVP
oh gawd, yes!



Merged from 'Allow Exceptions to be public' (idea created on 2014-09-01 18:34:20 by Justin James), on 2014-09-23 23:26:46 by GonƧalo BorrĆŖga
2016-04-21 18-13-58
Nuno Rolo
Ā 
MVP
Nice idea.

Merged from 'Allow Exceptions to be public' (idea created on 2014-09-01 18:34:20 by Justin James), on 2014-09-23 23:26:46 by GonƧalo BorrĆŖga
I found the need to handle message text shown in the various exceptions individually. Also there is no specific handler to timeout errors, for example.
So the idea was to have a centralized action where we could distinguish the type of exception that occurred in order to show different error text for each one.


Merged from 'Handle exception message individiually' (idea created on 2013-02-22 10:55:04 by PatrĆ­cia Lopes), on 2015-07-15 10:53:23 by Goncalo Borrega
When referencing a module action I'dd like to map the user exceptions that module has in order to correcly trap them on my module.

At this point I can raise specific user exception on one module, but I can't trap them on the other module, since user exceptions are limited to the module scope.

I always have to use the exception message to distinguish them but this is not the most elegant solution. 


Merged from 'Mark an exception as pulbic' (idea created on 2015-03-20 15:53:43 by Carlos Sousa), on 2015-07-15 10:54:58 by Goncalo Borrega
This should be merged with this one:

https://www.outsystems.com/ideas/100/allow-custom-exceptions-to-be-public-and-referenced-from-other-espaces

J.Ja


Merged from 'Mark an exception as pulbic' (idea created on 2015-03-20 15:53:43 by Carlos Sousa), on 2015-07-15 10:54:58 by Goncalo Borrega
You want to define exceptions where they occur - and you typically handle them somewhere else.
And you don't want all exceptions being catched with an "All exceptions" handler - in most programming languages using an "All exceptions handler" would be considered a blocking code style violations!

But without possibility to share exceptions between eSpaces, this is about the only choice... :-(

So would be very useful & much appreciated if this would be solved!

Jan-Hendrik

+1 Still missing in P9... have to return errors from other espace actions which can get messy.

Would appreciate this a lot!!! +1

I still want this!  It makes it a lot harder to catch an Exception coming from a module you are using.

Still missing it... We have a common exception handler but we don't have the change to raise the exceptions that we predicted on that module...

I also have a need for it. Now work around with a public static entity with ExceptionTypes.

I would also like to see this feature.

I need this feature.

It should be possible to mark an exception as public so that we can catch the exception in modules that consume the actions that throw it without using the "All Exceptions" handler.



Merged from 'It should be possible to expose an exception (Public=True)' (idea created on 2017-10-18 06:50:31 by JosƩ Gomes), on 2017-10-18 11:54:18 by Kilian Hekhuis

It would be nice to reuse all the user exceptions created by the developer on other modules. In this way, we could identify each exception and treat them in the specific Error Handler flow.

Example:

Module A_CS has a new User Exception called: InvalidParameter. 

Module B_EUM, consumes actions from A_CS and has the "InvalidParameter" Exception reference. In this way, the developer can treat the specific user exception without further logic.



Merged from 'Error Handler - User Exception reference' (idea created on 2017-11-15 16:48:53 by Miguel Sousa), on 2017-11-16 09:13:28 by Carlos Alfaro
2017-12-13 08-27-28
Joey Moree
Champion

I'm currently in need of this exact feature.

I have a webservice which throws an exception if input is incorrect, response is empty, or index is out of range, I want these different exceptions to be handled differently within other espaces where I use said webservice, however currently I can only use the ALL EXCEPTIONS handler and within it a switch with every possible exception I have.

It would be so much easier if I could just reference exceptions from another module.

It would be really interesting to hear OutSystems' thoughts here - to me this seems like an essential feature, and yet this idea has apparently been sitting here for 7+ years. Maybe I am misunderstanding something about how I should handle exceptions in OutSystems?

02-02-2018

Outsystems how about some update on this? :) 

+1

This will be very useful. Outsystems please add this feature.

2016-11-21 23-23-05
Gonçalo Borrêga
Merged this idea with 'Allow user exceptions to be referenced between eSpaces' (created on 2011-09-01 15:52:56 by AndrƩ Ramos)

+1 

We definitely need this :)

Please, please, please :)

In a nutshell, Exception handling in OutSystems sucks in a relly big way! Exceptions should be public, should be a part of the module's API just like actions, roles or entities... 

User exceptions available only within the same module? No way! We need to handle them from consuming module.

2024-01-12 11-11-18
Alfaro
Ā 
MVP
Merged this idea with 'Reusable exceptions' (created on 06 Nov 2018 20:34:35 by Raphael Ranieri)

Shoul be possible to expose exceptions to be used in other modules... 

Like make them public...



This comment was:
- originally posted on idea 'Reusable exceptions' (created on 06 Nov 2018 by Raphael Ranieri)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 09 Nov 2018 09:02:21 by Carlos Alfaro

Isn't this the same as https://www.outsystems.com/ideas/100/Allow+custom+Exceptions+to+be+public+and+referenced+from+other+espaces?IsFromAdvancedSearch=True ?



This comment was:
- originally posted on idea 'Reusable exceptions' (created on 06 Nov 2018 by Raphael Ranieri)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 09 Nov 2018 09:02:21 by Carlos Alfaro

Yeah!! Exactly that! 



This comment was:
- originally posted on idea 'Reusable exceptions' (created on 06 Nov 2018 by Raphael Ranieri)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 09 Nov 2018 09:02:21 by Carlos Alfaro

+1

We need this feature urgently, it does not make sense to have the possibility to reference several module objects and not be able to reference exceptions or make them public in some way that can be centralized at some point in the handling of errors.

Duplication of exceptions for the same purpose in different modules is a TERRIBLE practice.


Please, it's is a huge limitation on OS.

Seriously consider make it better.

I have referenced this idea on a more broad scenario where it's part of a set of limitations that block each other.

https://www.outsystems.com/ideas/6943/add-exception-handling-on-exposed-rest-api

Please consider remove some os this blocks.

MƔrcio.

9 years, still 'on our radar'...

It feels fairly standard to want to bubble an exception up to a higher level, especially if your application is structured into 4 layers as advised. The extremely poor exception handling is one of Outsystem's largest flaws that I have encountered so far.

Merged this idea with 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 08:46:12 by Nicholas van Wyngaard)

Allow user defined exceptions to be added as a dependency to a consumer module. 

This will allow the consumer to handle specific exceptions thrown by its dependencies. 

It is obviously possible to do by using an All Exceptions handler and then checking the message of the exception to pick up specific cases, but this could be handled in a more elegant way through dependencies.  



This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

Yes! I also was wondering why Exceptions can't be made public so I can consume those in other modules. By not having this handling exceptions is harder then it should be.



This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

Exactly. Then we can put our exceptions in the core module, just like we do with our roles.



This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

It is currently even worse, you can not even copy/paste them! why? nobody knows I think.

By the way, this ideas is already posted multiple times and could be merged to get a better voting on it and get more change of it being implemented.

The need to copy paste is mostly there because we can't make them public, still and the public property AND the option to copy paste would be nice to include.

https://www.outsystems.com/ideas/100/allow-custom-exceptions-to-be-public-and-referenced-from-other-espaces?IsFromAdvancedSearch=True

https://www.outsystems.com/ideas/2109/allow-copy-cut-paste-of-exceptions?IsFromAdvancedSearch=True

Also related if next idea would be implemented, less need to recreate exceptions:

https://www.outsystems.com/ideas/1706/add-new-standard-exceptions-allow-user-code-to-throw-them?IsFromAdvancedSearch=True




This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

Hi  DaniĆ«l,

Thank you for the information! I am glad to see the rest of the community agree that this would be beneficial. 

I would like to merge the ideas, is this something which I can do? Or do the community moderators do this? 

Thanks, 

Nicholas




This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

No normal community members cannot do it, only OutSystems staff and MVP's as far as I know.



This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

Funny enough, I came here to merge these ideas. :D

J.Ja



This comment was:
- originally posted on idea 'Add User Exceptions as Dependencies' (created on 04 Sep 2019 by Nicholas van Wyngaard)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 06 Sep 2019 15:53:34 by Justin James

Come on OutSystems, we developers need this really bad! Currently, handling exceptions between different modules is a pain in the ass!

Even worst is the fact remembered by Daniƫl about can't copy/past and when updating a cloned espace the merge window cannot bring these exceptions during merge, resulting in many errors to be manually fixed after merge. With the need to open two or more versions side by side to see what exceptions were missing, and creating one by one, and in each use of the new exceptions we need to fix the message. Very annoying limitation.

Merged this idea with 'Reactive Web - Allow Exceptions to be public to be referenced in other modules' (created on 04 Mar 2020 11:37:56 by Teresa Del Rio)

As is possible in traditional web, in Reactive web we need also need that exceptions can be public to be referenced in other modules



This comment was:
- originally posted on idea 'Reactive Web - Allow Exceptions to be public to be referenced in other modules' (created on 04 Mar 2020 by Teresa Del Rio)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 05 Mar 2020 04:08:28 by Justin James
Merged this idea with 'Support to handle user-exceptions in consumer modules' (created on 28 Sep 2020 14:09:47 by Hans Dollen)

As developer I would be able to raise an exception in e.g. a core module and handle that exception in a consumer module out-of-the-box.



This comment was:
- originally posted on idea 'Support to handle user-exceptions in consumer modules' (created on 28 Sep 2020 by Hans Dollen)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 04 Oct 2020 17:26:39 by Daniƫl Kuhlmann

What I am assuming you want is something like:

* Producer has an Exception type in it, like "NotImplementedException"

* Consumers would be able to see that Exception type and specifically handle it

Correct?

If so, I will merge this with the other Ideas out there for being able to make Exceptions public. If not, please provide some more information.

Thanks!

J.Ja



This comment was:
- originally posted on idea 'Support to handle user-exceptions in consumer modules' (created on 28 Sep 2020 by Hans Dollen)
- merged to idea 'Allow custom Exceptions to be public and referenced from other espaces' on 04 Oct 2020 17:26:39 by Daniƫl Kuhlmann

This still makes a lot of sense. Mapping exceptions to Success flags or other methods to "translate" exceptions between modules is really tedious and error-prone. 


Any updates on this being implemented?

Yes, it will be helpful. 

Well,


the idea is coming up on it's 11th birthday this spring (what was that, Outsystems 7 ?) so I wouldn't hold my breath.

Not really sure why this is not available yet. It is standard in so many OOP languages to have exceptions that can be bubbled up with their specific type and not just a generic type like AllExceptions type.

And it shouldn't be that hard, we are waiting for it ;)


It shouldn't be hard, but I bet the business value is quite low, so...

Maybe not directly measurable business value, but a platform must satisfy more requirements than just business value.

The last couple of months i was bombarded on linkedin with Outsystems commercials about how good they are for tackeling technical debt, fixing this type of platform shortcomings would fit right in that story.

Agree. Developers are also consumers of the technology and the better the tool in tackling complex tasks the more the development community will acept the tool. I know of quite many delayed projects due to lack of developers. So pleasing devs does also have its own business value. Many of us take pride in producing working quality software based on elegant solutions, and the maturity of the dev technology used has a big impact in this regard. ;)


2019-12-01 23-50-25
Pedro Neto
Champion

Hi guys, 

I have been following this ideia for some time and on the last notification I got I thought, Why not use the forge to create a temporary solution while this is not available on Service studio. 

So I created the following component GExceptions which is still in development. Please feel free to comment or discuss. 

Pedro -

I took a look at it, and it's nice to see the effort put forth to try to solve the problem, but it doesn't really solve the problems. I could go into some detail if you'd like, but as an example, because the consuming code can't differentiate well between a "GUserException" (because we don't have public exception lolol) and any other non-system Exception, the CatchException action doesn't help us. It also means we need to use Switch widgets in Exception handlers looking at string literals to decide how to handle the output, which is a complete non-starter. My suggestion would be, at the very least, to have applications "register" exceptions in a bootstrap from static entities (or something similar), with a unique ID, and be able to use that, so that this way they aren't juggling strong literals in every exception handler in the app. I also suspect that this will mess with transaction management in the cases where you don't want to abort transactions, though I'd have to use it in a real world scenario to verify that.

J.Ja

2019-12-01 23-50-25
Pedro Neto
Champion

Hi Justin,

Thanks for your comment, and Yeah I agree that it is a bummer not being able to directly catch the correct exception, but the ideia is to catch the exception using the Outsystems exception handler,  call the "CatchException" action from the module which returns a "GUserException", that has a unique ID which can be used to determine the paths on the switch module, and therefore you would not be comparing strings. 

For the transaction handling part, yeah that would be the most challenging part, because since all the GUserExceptions are basically a subset of Outsystems User Exceptions, on the "Exception Handler" Node for the user exception or you either "Abort" or not for all. 
Still this could be worked around if we just set "Abort Transaction" to no on the  OS Exception handler and then in the logic where the switch is you could call "AbortTransaction" action if that particular "GUserException" required it to do so. 

EDIT: Maybe adding this part about the handling of transactions on the component documentation would be a good ideia.

Pedro -

Yeah, I see how it works, but my concern is that the Switch on each Exception Handler is going to have a lot of logic looking like:

CatchException.ExceptionName = "ValidationException"

Which means that if you ever change the exception name, you need find every use of "CatchException" and inspect to see if it checks for "ValidationException". This is why I suggest using a registration system of exception names, so the applications can map their types to a unique ID that will never change (such as a GUID).

J.Ja

2019-12-01 23-50-25
Pedro Neto
Champion

The way it was designed was to use the ids and not hardcoded names , so actually the comparations would be something like : 

CatchException.Exception.UserExceptionId = Entities.UserException.ExampleException

Pedro -

Oh, I see. You wrote this the same way I originally wrote my configuration system in Application Framework, which turned out to be a big problem. It means that the only way to use this is to edit the module itself... which means it can't be upgraded from the Forge. This is why I had to switch to a registration pattern, so that the actual component could be upgraded from the Forge. It also properly separates the component itself from the logic of the consumers.

J.Ja

2019-12-01 23-50-25
Pedro Neto
Champion

Justin, yeah that was one of my concerns while developping it, but I couldn't find an easy way to allow the customization of the records without editing the module directly for the time being. I'll look into that registration pattern tomorrow. 

Thanks for your feedback!! 

Pedro -

Glad to help! Download "Application Framework" off the Forge, and look at how the Security and Configuration modules work, to get an idea of how I handled it. I don't like writing this kind of code, it makes it harder for the consuming developer to use, requires a lot of documentation, depends on bootstraps, and is more work for me... but there doesn't seem to be an alternative. :(

J.Ja

Yeah, we need this feature

It's surprising that after 10+ years, this feature has not been implemented, as it could greatly simplify the process of maintaining exceptions across multiple modules, particularly in larger solutions. 

Is there any proper workaround to handle this scenario? 

The only thing i can come up with is not something i would call proper.

You would have to add some logic to the exception message to explain what type of error it is:

ExceptionMessage: "ValidationException|blablabla"

And perhaps create a module to maintain these kind of exceptions.


For me it is not worth the effort, but i am still eagerly waiting for this feature. 

A definite must!

There is an ugly workaround: you can create a public Role and use its exception, instead of creating a User Exception. The exceptions defined under a Role are already public and you can explicitly raise them in a producer, and handle them in a consumer module. Interesting that this feature already exists, but is not made available for User Exceptions where they would be most valuable...

I would use this only as a last resort, and use a naming convention for these roles to signal that they are not meant for access control.

Also keep in mind that, by default, these exceptions are handled by the global exception handler and cause a redirect to InvalidPermissions screen.


For example, we have used this mechanism to signal that a user session is invalid (not due to an invalid login or lack of roles, but due to business rules). In that case, we could use the Not Registered exception, which can be raised in a producer module, and caught in a consumer module.

295
Like