natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
255 stars 81 forks source link

Is there a reason to fatal()? #163

Closed iUltimateLP closed 3 years ago

iUltimateLP commented 3 years ago

Title says it all. On errors the library tends to fatal(), which seems to force a crash the Switch, similar to assert(). Is there a reason for this? Why don't we use a quiet error method which won't terminate the whole thing?

natinusala commented 3 years ago

This fatal thing is used to raise "fatal" errors that cannot be recovered. I don't want to just log something and move on as it will easily be overlooked by users.

The right thing would be to use the "crash" dialog, but again what would happen if the crash dialog itself crashes?

Do we have the ability to spawn the OS crash dialog with our own message in Horizon? That might be the best option here. And for Windows / Linux, open a generic crash dialog using the OS API.

p-sam commented 3 years ago

Yes, we have the ability to invoke the error applet, but first it should be checked (I have never used it) that it doesn't send telemetry on its own (or if it used to on older versions), and that it allows to show a custom message, it might be just an error code for example

iUltimateLP commented 3 years ago

Yea, we do have a few options in libnx/error.h, however @p-sam is right, seems like the functions create an error report which is logged to the system, which doesn't seem optimal.

Personally, I dislike the whole Atmosphere crash screen, as it won't give you any info at all, whether it was an exception (and it's desc maybe) or anything else in most cases.

Maybe we can have a lightweight error dialog inside borealis itself - and as a last resort fallback, it'll fatal().

natinusala commented 3 years ago

To be clear I am not talking about the fatal sysmodule but about the "the software has closed" one

iUltimateLP commented 3 years ago

Ah, well that "The software has closed" dialog is fine, I was developing in applet / album mode, and there we just straight up get a Atmosphere crash instead of the dialog (at least as of Atmosphere 0.12, I'm a bit behind).

natinusala commented 3 years ago

This is not normal and should be fixed

DarkMatterCore commented 3 years ago

Crashes in applet mode always trigger the Atmosphère fatal screen. IIRC it's related to the way applets work - I don't think there's an easy fix for that.