emacs-module-0.2.1.1: Utilities to write Emacs dynamic modules
Copyright(c) Sergey Vinokurov 2018
LicenseApache-2.0 (see LICENSE)
Maintainerserg.foo@gmail.com
Safe HaskellSafe-Inferred
LanguageGHC2021

Emacs.Module.Errors

Description

This module defines various kinds of exception that this library

Synopsis

Documentation

data EmacsThrow Source #

A Haskell exception used to signal a throw exit performed by an Emacs function.

Unlikely to be needed when developing Emacs extensions.

Constructors

EmacsThrow 

Fields

reportEmacsThrowToEmacs :: Env -> EmacsThrow -> IO (RawValue 'Unknown) Source #

data EmacsSignal Source #

A Haskell exception used to signal a signal exit performed by an Emacs function.

Unlikely to be needed when developing Emacs extensions.

Constructors

EmacsSignal 

Fields

reportEmacsSignalToEmacs :: Env -> EmacsSignal -> IO (RawValue 'Unknown) Source #

data EmacsError Source #

A high-level error thrown when an Emacs function fails.

Instances

Instances details
Exception EmacsError Source # 
Instance details

Defined in Emacs.Module.Errors

Show EmacsError Source # 
Instance details

Defined in Emacs.Module.Errors

Pretty EmacsError Source # 
Instance details

Defined in Emacs.Module.Errors

Methods

pretty :: EmacsError -> Doc ann #

prettyList :: [EmacsError] -> Doc ann #

mkEmacsError Source #

Arguments

:: WithCallStack 
=> Doc Void

Message

-> Doc Void

Error data from Emacs

-> EmacsError 

reportErrorToEmacs :: Env -> EmacsError -> IO (RawValue 'Unknown) Source #

data EmacsInternalError Source #

A low-level error thrown when assumptions of this package are violated and it's not safe to proceed further.

E.g. Emacs returned value not specified in a C enum - cannot really process it in a meaningful way.

data UserError Source #

Error thrown to emacs by Haskell functions when anything goes awry.

Instances

Instances details
Exception UserError Source # 
Instance details

Defined in Emacs.Module.Errors

Show UserError Source # 
Instance details

Defined in Emacs.Module.Errors

Pretty UserError Source # 
Instance details

Defined in Emacs.Module.Errors

Methods

pretty :: UserError -> Doc ann #

prettyList :: [UserError] -> Doc ann #

mkUserError Source #

Arguments

:: WithCallStack 
=> Doc Void

Function name

-> Doc Void

Message body

-> UserError 

reportAnyErrorToEmacs :: Env -> SomeException -> IO (RawValue 'Unknown) Source #

reportAllErrorsToEmacs Source #

Arguments

:: Env 
-> IO a

Result to return on error.

-> IO a 
-> IO a 

Catch all errors this package might throw in an IO action and make Emacs aware of them.

This is a convenience function intended to be used around exported initialise entry point into an Emacs module.