Skip to content

Instantly share code, notes, and snippets.

@kirillgashkov
Created June 11, 2018 18:53
Show Gist options
  • Save kirillgashkov/799991bb63355afd5a755dc9d7876b04 to your computer and use it in GitHub Desktop.
Save kirillgashkov/799991bb63355afd5a755dc9d7876b04 to your computer and use it in GitHub Desktop.
A list of common Swift exception types.

Swift Exception Types

A list of common Swift exception types.

EXC_BAD_ACCESS; SIGSEGV; SIGBUS

Bad Memory Access.

The process attempted to access invalid memory, or it attempted to access memory in a manner not allowed by the memory's protection level (e.g. writing to read-only memory).

EXC_CRASH, SIGABRT

Abnormal Exit.

The process exited abnormally. The most common causes of crashes with this exception type are uncaught Objective-C/C++ exceptions and calls to abort().

EXC_BREAKPOINT, SIGTRAP

Trace Trap.

Similar to an Abnormal Exit, this exception is intended to give an attached debugger the chance to interrupt the process at a specific point in its execution.

Swift code will terminate with this exception type if an unexpected condition is encountered at runtime such as:

  • a non-optional type with a nil value;
  • a failed forced type conversion.

EXC_BAD_INSTRUCTION, SIGILL

Illegal Instruction.

The process attempted to execute an illegal or undefined instruction. The process may have attempted to jump to an invalid address via a misconfigured function pointer.

SIGQUIT

Quit.

The process was terminated at the request of another process with privileges to manage its lifetime. SIGQUIT does not mean that the process crashed, but it did likely misbehave in a detectable manner.

SIGKILL

Killed.

The process was terminated at the request of the system.

EXC_GUARD

Guarded Resource Violation.

The process violated a guarded resource protection. System libraries may mark certain file descriptors as guarded, after which normal operations on those descriptors will trigger an EXC_GUARD exception.

EXC_RESOURCE

Resource Limit.

The process exceeded a resource consumption limit. This is a notification from the OS that the process is using too many resources.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment