Skip to content

Exceptions and data safety #57844

@kpamnany

Description

@kpamnany

#51673 opens a discussion on exceptions, but doesn't really seem to go anywhere.

We have a different angle to consider, thus I'm opening a separate issue: it is not unusual for packages to throw exceptions and embed user-provided data in the exception message. For security and privacy reasons, we do not want to log user-provided data so we cannot generally log exception messages which is quite annoying when you're trying to figure out why an exception was thrown.

It is impractical to verify the safety of the contents of exceptions thrown from all packages, but it is practical to do so for Base. Unfortunately, even if we did this verification, there's no easy way to disambiguate an exception thrown from Base from an exception thrown from a package... unless they are different exceptions.

To that end, we'd like to introduce an InternalException and replace error() calls in Base with something that raises one of these. We could potentially go further and introduce a type hierarchy of internal exceptions that are only raised in Base, but this might get complicated. We could then treat all InternalExceptions as "safe to log".

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    designDesign of APIs or of the language itselferror handlingHandling of exceptions by Julia or the user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions