fatal_error Subroutine

public subroutine fatal_error(error, message, stat)

A fatal error is encountered

Arguments

Type IntentOptional Attributes Name
type(error_type), intent(out), allocatable :: error

Instance of the error

character(len=*), intent(in), optional :: message

A detailed message describing the error and (optionally) offering advice

integer, intent(in), optional :: stat

Overwrite of the error code


Source Code

subroutine fatal_error(error, message, stat)

   !> Instance of the error
   type(error_type), allocatable, intent(out) :: error

   !> A detailed message describing the error and (optionally) offering advice
   character(len=*), intent(in), optional :: message

   !> Overwrite of the error code
   integer, intent(in), optional :: stat

   allocate(error)

   if (present(stat)) then
      error%stat = stat
   else
      error%stat = mctc_stat%fatal
   end if

   if (present(message)) then
      error%message = message
   else
      error%message = "Fatal error"
   end if

end subroutine fatal_error