iOS SwiftUI captures crashes but not errors

We would like to adopt sentry to our app, however Sentry seems to only capture crashes and not errors (like network errors).

App is built with SwiftUI.

Documentation requires to add Principal class to be SentryCrashExceptionApplication in plist.info. However, if I do so, the app crashes during launch.

Is automatic error capturing available for SwiftUI apps?

What do you define as an error? You mean like when you call your backend, and it returns 500? In that case you can programatically check the status code against what you expect, and if it’s not that, capture the error with the Sentry SDK like SentrySDK.capture(error: ..

What library do you use to issue HTTP requests? We are looking into publishing integrations.

Or do you mean some other type of error? Please clarify

HI @bruno-garcia thanks for the reply. Yes, network errors would be an example. I just was not sure what SentryCrashExceptionApplication given it does not work for SwitfUI projects. Thanks for the suggestion, I will use .capture. Currently we are using Alamofire for networking.

We plan to add support to Alamofire. We could capture an error if the API returns 5xx status code but other than that it would have to be manually capture by you as discussed.
Besides that we would add a breadcrumb to track the API call and it would allow linking the errors from your mobile app with your backend (do you have your backend connected to Sentry? What SDK do you use?)