imerror.pas

来自「ImageMagick library of image with Visua」· PAS 代码 · 共 132 行

PAS
132
字号
{
  Translated: 19 March 2003
  Translator: Ian Stuart

  25 March 2003: Added MagickFatalError.

  -------------------------------------------------------------------------

  The contents of this file are subject to the Mozilla Public
  License Version 1.1 (the "License"); you may not use this file
  except in compliance with the License. You may obtain a copy of
  the License at:
  http://www.mozilla.org/MPL/

  Software distributed under the License is distributed on an
  "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  implied. See the License for the specific language governing
  rights and limitations under the License.
}

unit ImError;

interface

const
  // Im Exceptions
  imUndefinedException = 0;
  imWarningException = 300;
  imResourceLimitWarning = 300;
  imTypeWarning = 305;
  imOptionWarning = 310;
  imDelegateWarning = 315;
  imMissingDelegateWarning = 320;
  imCorruptImageWarning = 325;
  imFileOpenWarning = 330;
  imBlobWarning = 335;
  imStreamWarning = 340;
  imCacheWarning = 345;
  imCoderWarning = 350;
  imModuleWarning = 355;
  imDrawWarning = 360;
  imImageWarning = 365;
  imXServerWarning = 380;
  imMonitorWarning = 385;
  imRegistryWarning = 390;
  imConfigureWarning = 395;
  imErrorException = 400;
  imResourceLimitError = 400;
  imTypeError = 405;
  imOptionError = 410;
  imDelegateError = 415;
  imMissingDelegateError = 420;
  imCorruptImageError = 425;
  imFileOpenError = 430;
  imBlobError = 435;
  imStreamError = 440;
  imCacheError = 445;
  imCoderError = 450;
  imModuleError = 455;
  imDrawError = 460;
  imImageError = 465;
  imXServerError = 480;
  imMonitorError = 485;
  imRegistryError = 490;
  imConfigureError = 495;
  imFatalErrorException = 700;
  imResourceLimitFatalError = 700;
  imTypeFatalError = 705;
  imOptionFatalError = 710;
  imDelegateFatalError = 715;
  imMissingDelegateFatalError = 720;
  imCorruptImageFatalError = 725;
  imFileOpenFatalError = 730;
  imBlobFatalError = 735;
  imStreamFatalError = 740;
  imCacheFatalError = 745;
  imCoderFatalError = 750;
  imModuleFatalError = 755;
  imDrawFatalError = 760;
  imImageFatalError = 765;
  imXServerFatalError = 780;
  imMonitorFatalError = 785;
  imRegistryFatalError = 790;
  imConfigureFatalError = 795;

type
  TImExceptionType = Cardinal;

  PImrExceptionInfo = ^TImrExceptionInfo;
  TImrExceptionInfo = record
    Severity: TImExceptionType;
    ErrorNumber: Integer;
    Reason: PChar;
    Description: PChar;
    Signature: Cardinal;
  end;

  TImErrorHandler = procedure(const ExceptionType: TImExceptionType; const Reason, Description: PChar); cdecl;

// default handler if you want to use them.
procedure ErrorHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar); cdecl;
procedure WarningHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar); cdecl;
procedure FatalErrorHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar); cdecl;


implementation

uses
  SysUtils;


procedure ErrorHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar);
begin
  raise Exception.CreateFmt('Magick Error: %d'#13#10'Reason: %s'#13#10'Description: %s', [Integer(ExceptionType), Reason, Description]);
end;

procedure WarningHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar);
begin
  raise Exception.CreateFmt('Magick Error: %d'#13#10'Reason: %s'#13#10'Description: %s', [Integer(ExceptionType), Reason, Description]);
end;

procedure FatalErrorHandler(const ExceptionType: TImExceptionType; const Reason, Description: PChar);
begin
  raise Exception.CreateFmt('Magick Error: %d'#13#10'Reason: %s'#13#10'Description: %s', [Integer(ExceptionType), Reason, Description]);
end;



end.


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?