加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

AutoCAD .NET开发,Autodesk.AutoCAD.Runtime.Exception异常类的使用说明!

(2017-01-26 22:12:36)
分类: AutoCAD二次开发(DOTNET)
    一般而言,在.NET中,系统引发的异常由System.Exception 类及其派生类表示,派生类表示更为精确的异常,如访问不存在的文件时,会引发System.IO.FileNotFoundException类异常。同时AutoCAD API还定义了一个派生于System.Exception 类的Autodesk.AutoCAD.Runtime.Exception类,用来处理与AutoCAD操作有关的异常。
System.Exception类及其派生类拥有多个属性,其中最重要的属性是Message和Source。Message属性包含当前异常原因的错误信息,Source属性表示导致错误的应用程序或对象的名称。TargetSite属性表示引发当前异常的方法。
Autodesk.AutoCAD.Runtime.Exception 类除了System.Exception类的属性外,另外还提供了ErrorStatus属性,用来表示与当前异常关联的错误状态代码,它属于Autodesk.AutoCAD.Runtime.ErrorStatus枚举。
 Autodesk.AutoCAD.Runtime.ErrorStatus枚举的内容如下:
   AlreadyActive = 0x4e53, 
   AlreadyInactive = 0x4e54, 
   AlreadyInDB = 0x1a, 
   AlreadyInGroup = 260, 
   AmbiguousInput = 4, 
   AmbiguousOutput = 5, 
   AnonymousEntry = 0x26, 
   AtMaxReaders = 90, 
   BackgroundPlotInProgress = 0x20f, 
   BadColor = 0xd0, 
   BadColorIndex = 0xca, 
   BadDwgHeader = 0x13a, 
   BadDxfFile = 0x170, 
   BadDxfSequence = 0x34, 
   BadLayerName = 200, 
   BadLinetypeName = 0xcb, 
   BadLinetypeScale = 0xcc, 
   BadLineWeightValue = 0xcf, 
   BadlyNestedAppData = 0x17a, 
   BadPaperspaceView = 0xa9, 
   BadPlotStyleName = 0x180, 
   BadPlotStyleNameHandle = 0x183, 
   BadPlotStyleType = 0x182, 
   BadUcs = 0xa8, 
   BadVisibilityValue = 0xcd, 
   BinaryDataSizeExceeded = 0x187, 
   BlockDefInEntitySection = 0x17d, 
   BrokenHandle = 12, 
   BufferTooSmall = 7, 
   CannotBeErasedByCaller = 0x69, 
   CannotBeResurrected = 0x6a, 
   CannotChangeActiveViewport = 140, 
   CannotChangeColumnType = 0x1b9, 
   CannotExplodeEntity = 0x9f, 
   CannotNestBlockDefinitions = 0x3b, 
   CannotPlotToFile = 0x20c, 
   CannotRestoreFromAcisFile = 300, 
   CannotScaleNonUniformly = 0x88, 
   CantOpenFile = 0x16c, 
   CloseFailObjectDamaged = 0x68, 
   CloseModifyAborted = 0x66, 
   ClosePartialFailure = 0x67, 
   CloseWasNotifying = 0x65, 
   CommandWasInProgress = 0x8e, 
   ContainerNotEmpty = 0x12, 
   CopyDoesNotExist = 0x162, 
   CopyFailed = 0x164, 
   CopyInvalidName = 0x165, 
   CopyIsModelSpace = 0x163, 
   CopyNameExists = 0x166, 
   CreateFailed = 0x151, 
   CreateInvalidName = 0x152, 
   CustomSizeNotPossible = 0x202, 
   DatabaseObjectsOpen = 0x142, 
   DataLinkAdapterNotFound = 650, 
   DataLinkBadConnectionString = 0x28d, 
   DataLinkConnectionFailed = 0x290, 
   DataLinkInvalidAdapterId = 0x28b, 
   DataLinkNotFound = 0x28c, 
   DataLinkNotUpdatedYet = 0x28e, 
   DataLinkOtherError = 660, 
   DataLinkSourceIsWriteProtected = 0x292, 
   DataLinkSourceNotFound = 0x28f, 
   DegenerateGeometry = 0x99, 
   DelDoesNotExist = 0x156, 
   DeletedEntry = 0x1c, 
   DeleteEntity = 0xbf, 
   DelIsModelSpace = 0x157, 
   DelLastLayout = 0x158, 
   DelUnableToFind = 0x15a, 
   DelUnableToSetCurrent = 0x159, 
   DeviceNotFound = 0x1f8, 
   DocumentSwitchDisabled = 0x14e, 
   DuplicateBlockDefinition = 0x185, 
   DuplicateBlockName = 0x181, 
   DuplicateDxfField = 0x31, 
   DuplicateIndex = 0x19, 
   DuplicateKey = 0x17, 
   DuplicateLayerName = 0x17f, 
   DuplicateRecordName = 0x5f, 
   DwgCrcDoesNotMatch = 0x41, 
   DwgNeedsAFullSave = 0x45, 
   DwgNeedsRecovery = 190, 
   DwgNotRecoverable = 0x3d, 
   DwgObjectImproperlyRead = 0x43, 
   DwgRecoveredOK = 60, 
   DwgSentinelDoesNotMatch = 0x42, 
   DwgShareDemandLoad = 500, 
   DwgShareReadAccess = 0x1f5, 
   DwgShareWriteAccess = 0x1f6, 
   DwkLockFileFound = 0x4d, 
   DxbPartiallyRead = 0x40, 
   DxbReadAborted = 70, 
   DxfPartiallyRead = 0x3e, 
   DxfReadAborted = 0x3f, 
   EndOfFile = 0x29, 
   EndOfObject = 40, 
   EntityInInactiveLayout = 9, 
   ExcessiveItemCount = 0xa6, 
   ExplodeBeforeTransform = 0x87,
 
  ExternalDataSizeExceeded = 0x7d, 
   FileAccessErr = 0x48,
 
  FileExists = 0x16a, 
   FileInternalErr = 0x4a, 
   FileLockedByAutoCAD = 0x47, 
   FileMissingSections = 0x1b4, 
   FileNotFound = 0x4c, 
   FilerError = 0x35, 
   FileSharingViolation = 0x1b1, 
   FileSystemErr = 0x49,
 
  FileTooManyOpen = 0x4b, 
   FiniteStateMachineError = 0xc1, 
   FixedAllErrors = 120, 
   GeneralModelingFailure = 150, 
   GraphicsNotGenerated = 0x20b, 
   GuidNoAddress = 0x18a, 
   HadMultipleReaders = 0x5e,
 
  HandleExists = 10, 
   HandleInUse = 14,
 
  HatchTooDense = 420, 
   IgnoredLinetypeRedefinition = 0xa7, 
   IllegalEntityType = 0x15, 
   IllegalReplacement = 0x27, 
   IncompatiblePlotSettings = 0x1fc, 
   IncompleteBlockDefinition = 0x17b,
 
  IncompleteComplexObject = 380,
 
  InProcessOfCommitting = 0xfd,
 
  InsertAfter = 110,
 
  InternetBadPath = 0x4e23,
 
  InternetBase = 0x4e20,
 
  InternetCreateInternetSessionFailed = 0x4e33,
 
  InternetDirectoryFull = 0x4e27, 
   InternetDiskFull = 0x4e2a,
 
  InternetFileAccessDenied = 0x4e25, 
   InternetFileGenericError = 0x4e2b,
 
  InternetFileNotFound = 0x4e22,
 
  InternetFileOpenFailed = 0x4e37, 
   InternetGenericException = 0x4e51,
 
  InternetHardwareError = 0x4e28,
 
  InternetHttpAccessDenied = 0x4e3b, 
   InternetHttpBadGateway = 0x4e4c,
 
  InternetHttpBadMethod = 0x4e3f, 
   InternetHttpBadRequest = 0x4e3a,
 
  InternetHttpConflict = 0x4e43,
 
  InternetHttpGatewayTimeout = 0x4e4e,
 
  InternetHttpLengthRequired = 0x4e45,
 
  InternetHttpNoAcceptableResponse = 0x4e40,
 
  InternetHttpNotSupported = 0x4e4b,
 
  InternetHttpObjectNotFound = 0x4e3e, 
   InternetHttpOpenRequestFailed = 0x4e38, 
   InternetHttpPaymentRequired = 0x4e3c, 
   InternetHttpPreconditionFailure = 0x4e46, 
   InternetHttpProxyAuthorizationRequired = 0x4e41,
 
  InternetHttpRequestForbidden = 0x4e3d, 
   InternetHttpRequestTooLarge = 0x4e47, 
   InternetHttpResourceGone = 0x4e44, 
   InternetHttpServerError = 0x4e4a,
 
  InternetHttpServiceUnavailable = 0x4e4d,
 
  InternetHttpTimedOut = 0x4e42, 
   InternetHttpUnsupportedMedia = 0x4e49,
 
  InternetHttpUriTooLong = 0x4e48, 
   InternetHttpVersionNotSupported = 0x4e4f, 
   InternetInCache = 0x4e21, 
   InternetInternetError = 0x4e50,
 
  InternetInternetSessionConnectFailed = 0x4e34, 
   InternetInternetSessionOpenFailed = 0x4e35,
 
  InternetInvalidAccessType = 0x4e36, 
   InternetInvalidFileHandle = 0x4e26,
 
  InternetNoInternetSupport = 0x4e30, 
   InternetNotAnUrl = 0x4e2d,
 
  InternetNotImplemented = 0x4e31,
 
  InternetNoWinInternet = 0x4e2e,
 
  InternetOK = 0x4e20, 
   InternetOldWinInternet = 0x4e2f, 
   InternetProtocolNotSupported = 0x4e32,
 
  InternetSharingViolation = 0x4e29, 
   InternetTooManyOpenFiles = 0x4e24,
 
  InternetUnknownError = 0x4e52, 
   InternetUserCancelledTransfer = 0x4e39,
 
  InternetValidUrl = 0x4e2c,
 
  InvalidAdsName = 0x1f,
 
  InvalidAxis = 0x9a, 
   InvalidBlockName = 0x2f, 
   InvalidContext = 0x14f,
 
  InvalidDimStyle = 0xac,
 
  InvalidDwgVersion = 0x25,
 
  InvalidDxf2dPoint = 0x177
,
  InvalidDxf3dPoint = 0x178,
 
  InvalidDxfCode = 50,
 
  InvalidDxfSectionName = 0x173,
 
  InvalidEngineState = 0x205,
 
  InvalidExtents = 30, 
   InvalidFaceVertexIndex = 0x37,
 
  InvalidFileExtension = 360,
 
  InvalidFix = 0xc0, 
   InvalidIdMap = 220,
 
  InvalidIndex = 0x18,
 
  InvalidInput = 3,
 
  InvalidInterfaceId = 290,
 
  InvalidKey = 0x21, 
   InvalidLayer = 0xad, 
   InvalidMeshVertexIndex = 0x38, 
   InvalidNormal = 0x123,
 
  InvalidObjectId = 600,
 
  InvalidOffset = 0x9d, 
   InvalidOpenState = 8,
 
  InvalidOwnerObject = 0xdd,
 
  InvalidPlotArea = 0x201,
 
  InvalidPlotInfo = 520, 
   InvalidProfileName = 0x169, 
   InvalidResultBuffer = 0x33,
 
  InvalidStyle = 0x124, 
   InvalidSymbolTableName = 0x20, 
   InvalidSymTableFlag = 0xa1, 
   InvalidTextStyle = 0xa3,
 
  InvalidView = 0x1ff, 
   InvalidWindowArea = 0x200,
 
  InvalidXrefObjectId = 0x259,
 
  IsAnEntity = 0x8b,
 
  IsReading = 0x2a,
 
  IsWriteProtected = 0x5b, 
   IsWriting = 0x2b,
 
  IsXRefObject = 0x5c, 
   IteratorDone = 0x81, 
   KeyNotFound = 0x16, 
   LayerGroupCodeMissing = 0xc9,
 
  LayoutNotCurrent = 0x20a,
 
  LeftErrorsUnfixed = 0x7a, 
   LispActive = 0x14c, 
   LoadFailed = 0x1f7, 
   LockChangeInProgress = 0x143,
 
  LockConflict = 0x141,
 
  LockViolation = 320, 
   LongTransReferenceError = 0xff,
 
  MakeMeProxy = 0x12d, 
   MakeMeProxyAndResurrect = 0x1b0, 
   MaxLayouts = 0x198, 
   MissingBlockName = 390, 
   MissingDxfField = 0x30, 
   MissingDxfSection = 370, 
   MissingSymbolTable = 0x62, 
   MissingSymbolTableRecord = 0x63, 
   MustBe0to2 = 0x18b, 
   MustBe0to3 = 0x18c, 
   MustBe0to4 = 0x18d, 
   MustBe0to5 = 0x18e, 
   MustBe0to8 = 0x18f, 
   MustBe1to15 = 0x191, 
   MustBe1to6 = 0x195, 
   MustBe1to8 = 400, 
   MustBeNonNegative = 0x193, 
   MustBeNonZero = 0x194, 
   MustBePositive = 0x192,
 
  MustFirstAddBlockToDB = 0x3a,
 
  MustOpenThruOwner = 0x58, 
   MustPlotToFile = 0x20d,
 
  NegativeValueNotAllowed = 0x1d, 
   NlsFileNotAvailable = 0x12e, 
   NoActiveTransactions = 250, 
   NoBlockBegin = 0x17e, 
   NoClassId = 0x199, 
   NoCurrentConfig = 0x1f9,
 
  NoDatabase = 0x7c, 
   NoDocument = 330, 
   NoErrorHandler = 0x207, 
   NoFileName = 0x16d, 
   NoInputFiler = 0x44,
 
  NoInternalSpace = 0xab, 
   NoLabelBlock = 0x25b,
 
  NoLayout = 0x1fb, 
   NoMatchingMedia = 510, 
   NonCoplanarGeometry = 0x98, 
   NonePlotDevice = 0x1fd, 
   NonPlanarEntity = 0x9e, 
   NoPlotStyleTranslationTable = 0x196,
 
  NotAllowedForThisProxy = 0x12f, 
   NotAnEntity = 0x5d, 
   NotApplicable = 2, 
   NotCurrentDatabase = 0x8a,
 
  NotDxfHeaderGroupCode = 0x174,
 
  NotFromThisDocument = 0x14b, 
   NotHandled = 0x1af,
 
  NoThumbnailBitmap = 0x189, 
   NotImplementedYet = 1, 
   NotInBlock = 0x83, 
   NotInDatabase = 0x89, 
   NotInGroup = 0x105, 
   NotInitializedYet = 0x176, 
   NotInPaperspace = 0x8d, 
   NotMultiPageCapable = 0x20e, 
   NotNewlyCreated = 0xfe, 
   NotOpenForRead = 0x2c, 
   NotOpenForWrite = 0x2d, 
   NotSupportedInDwgApi = 310, 
   NotThatKindOfClass = 0x2e, 
   NotTopTransaction = 0xfb, 
   NoViewAssociation = 0x25a, 
   NoWorkSet = 0x100, 
   NullBlockName = 0x11, 
   NullEntityPointer = 20, 
   NullExtents = 0x138, 
   NullHandle = 11,
 
  NullIterator = 130, 
   NullObjectId = 0x10, 
   NullObjectPointer = 15,
 
  NullPtr = 0x1fa,
   NumberOfCopiesNotSupported = 0x209, 
   ObjectIsReferenced = 0x188, 
   ObjectToBeDeleted = 0x24, 
   ObsoleteFileFormat = 0x1b3, 
   OK = 0, 
   OnLockedLayer = 0x57, 
   OpenFileCancelled = 430, 
   OtherObjectsBusy = 0x39, 
   OutOfDisk = 0x1b,
 
  OutOfMemory = 6, 
   OutOfPagerMemory = 0xd3,
 
  OutOfRange = 0x97, 
   OwnerNotInDatabase = 0x84,
 
  OwnerNotOpenForRead = 0x85,
 
  OwnerNotOpenForWrite = 0x86, 
   OwnerNotSet = 0xde, 
   PageCancelled = 0x203, 
   PagerError = 210, 
   PagerWriteError = 0xd4,
 
  PermanentlyErased = 0x51,
 
  PlotAlreadyStarted = 0x206,
 
  PlotCancelled = 0x204, 
   PlotStyleInColorDependentMode = 0x197, 
   PointNotOnEntity = 0x9b, 
   PolyWidthLost = 0x137, 
   ProfileDoesNotExist = 0x167, 
   ProfileIsInUse = 0x16b, 
   ProperClassSeparatorExpected = 0xce, 
   RecordNotInTable = 0x80, 
   RegisteredApplicationIdNotFound = 0x7e,
 
  RegistryAccessError = 0x16e, 
   RegistryCreateError = 0x16f, 
   RenameDoesNotExist = 0x15c, 
   RenameInvalidLayoutName = 350, 
   RenameInvalidName = 0x160, 
   RenameIsModelSpace = 0x15d, 
   RenameLayoutAlreadyExists = 0x15f, 
   RepeatedDwgRead = 0x1b5, 
   RepeatEntity = 0x7f, 
   RowsMustMatchColumns = 0x1ba, 
   SecErrorCipherNotSupported = 0x4b2, 
   SecErrorComputingSignature = 0x44f, 
   SecErrorDecryptingData = 0x4b3,
 
  SecErrorEncryptingData = 0x4b1, 
   SecErrorGeneratingTimestamp = 0x44e, 
   SecErrorReadingFile = 0x3ea, 
   SecErrorWritingFile = 0x3eb,
 
  SecErrorWritingSignature = 0x450, 
   SecInitializationFailure = 0x3e9,
 
  SecInvalidDigitalId = 0x44d,
 
  SelfReference = 0x61, 
   SetFailed = 340, 
   SingularPoint = 0x9c,
 
  SomeInputDataLeftUnread = 170, 
   StringTooLong = 160, 
   SubentitiesStillOpen = 0x59, 
   SubSelectionSetEmpty = 550,
 
  TargetDocNotQuiescent = 0x14d,
 
  TooFewLineTypeElements = 0xa4, 
   TooFewVertices = 0xe8,
 
  TooManyLineTypeElements = 0xa5,
 
  TooManyVertices = 0xe7, 
   TransactionOpenWhileCommandEnded = 0xfc, 
   UnableToGetLabelBlock = 0x25f, 
   UnableToGetViewAssociation = 0x25d, 
   UnableToRemoveAssociation = 0x260, 
   UnableToSetLabelBlock = 0x25e, 
   UnableToSetViewAssociation = 0x25c, 
   UnableToSyncModelView = 0x261,
 
  UndefinedDxfGroupCode = 0x175, 
   UndefinedLineType = 0xa2, 
   UndefineShapeName = 0x184, 
   UndoNoGroupBegin = 0x19b, 
   UndoOperationNotAvailable = 410, 
   UnknownDxfFileFormat = 0x171, 
   UnknownHandle = 13,
 
  UnrecoverableErrors = 0x7b, 
   UnsupportedFileFormat = 0x1b2, 
   UserBreak = 180,
 
  VertexAfterFace = 0x36, 
   Vetoed = 0x145, 
   WasErased = 80, 
   WasNotErased = 0x6b, 
   WasNotForwarding = 0xd5, 
   WasNotifying = 0x55, 
   WasNotOpenForWrite = 100, 
   WasOpenForNotify = 0x56, 
   WasOpenForRead = 0x52, 
   WasOpenForUndo = 0x54, 
   WasOpenForWrite = 0x53, 
   WrongCellType = 440,
 
  WrongDatabase = 0x23, 
   WrongObjectType = 0x22,
 
  WrongSubentityType = 230, 
   XRefDependent = 0x60 
  

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有