use thiserror::Error;
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum FormError {
#[error("The `ComboBox` style is invalid: '{value}'. Only 0 (Dropdown Combo), 1 (Simple Combo), or 2 (Dropdown List) are valid styles.")]
InvalidComboBoxStyle {
value: String,
},
#[error("The `CheckBox` value is invalid: '{value}'. Only 0 (Unchecked), 1 (Checked), or 2 (Grayed) are valid values.")]
InvalidCheckBoxValue {
value: String,
},
#[error("The `PropertyGroup` name is invalid: expected '{expected}', found '{found}'.")]
InvalidPropertyGroupName {
expected: String,
found: String,
},
#[error("The `BOFAction` value is invalid: '{value}'. Only 0 (MoveFirst), or 1 (BOF) are valid values.")]
InvalidBOFAction {
value: String,
},
#[error("The `ConnectionType` value is invalid: '{value}'. Only 'Access', 'dBase III', 'dBase IV', 'dBase 5.0', 'Excel 3.0', 'Excel 4.0', 'Excel 5.0', 'Excel 8.0', 'FoxPro 2.0', 'FoxPro 2.5', 'FoxPro 2.6', 'FoxPro 3.0', 'Lotus WK1', 'Lotus WK3', 'Lotus WK4', 'Paradox 3.X', 'Paradox 4.X', 'Paradox 5.X', or 'Text' are valid values.")]
InvalidConnectionType {
value: String,
},
#[error("The `DefaultCursorType` value is invalid: '{value}'. Only 0 (Default), 1 (Odbc), or 2 (ServerSide) are valid values.")]
InvalidDefaultCursorType {
value: String,
},
#[error("The `DatabaseDriverType` value is invalid: '{value}'. Only 1 (ODBC), or 2 (Jet) are valid values.")]
InvalidDatabaseDriverType {
value: String,
},
#[error("The `EOFAction` value is invalid: '{value}'. Only 0 (MoveLast), 1 (EOF), or 2 (AddNew) are valid values.")]
InvalidEOFAction {
value: String,
},
#[error("The `RecordSetType` value is invalid: '{value}'. Only 0 (Table), 1 (Dynaset), or 2 (Snapshot) are valid values.")]
InvalidRecordSetType {
value: String,
},
#[error("The `ArchiveAttribute` value is invalid: '{value}'. Only 0 (Exclude) or -1 (Include) are valid values.")]
InvalidArchiveAttribute {
value: String,
},
#[error("The `Hidden` valud is invalid: '{value}'. Only 0 (Exclude) or -1 (Include) are valid values.")]
InvalidHiddenAttribute {
value: String,
},
#[error("The `ReadOnly` value is invalid: '{value}'. Only 0 (Exclude) or -1 (Include) are valid values.")]
InvalidReadOnlyAttribute {
value: String,
},
#[error("The `System` value is invalid: '{value}'. Only 0 (Exclude) or -1 (Include) are valid values.")]
InvalidSystemAttribute {
value: String,
},
#[error("The `Normal` value is invalid: '{value}'. Only 0 (Exclude) or -1 (Include) are valid values.")]
InvalidNormalAttribute {
value: String,
},
#[error("The `FormBorderStyle` value is invalid: '{value}'. Only 0 (None), 1 (FixedSingle), 2 (Sizable), 3 (FixedDialog), 4 (FixedToolWindow), or 5 (SizableToolWindow) are valid values.")]
InvalidFormBorderStyle {
value: String,
},
#[error("The `ControlBox` value is invalid: '{value}'. Only 0 (Excluded) or -1 (Included) are valid values.")]
InvalidControlBox {
value: String,
},
#[error("The `MaxButton` value is invalid: '{value}'. Only 0 (Excluded) or -1 (Included) are valid values.")]
InvalidMaxButton {
value: String,
},
#[error("The `MinButton` value is invalid: '{value}'. Only 0 (Excluded) or -1 (Included) are valid values.")]
InvalidMinButton {
value: String,
},
#[error("The `PaletteMode` value is invalid: '{value}'. Only 0 (HalfTone), 1 (UseZOrder), or 2 (Custom) are valid values.")]
InvalidPaletteMode {
value: String,
},
#[error(
"The `WordWrap` value is invalid: '{value}'. Only 0 (False) or -1 (True) are valid values."
)]
InvalidWordWrap {
value: String,
},
#[error("The `WhatsThisButton` value is invalid: '{value}'. Only 0 (Excluded) or -1 (Included) are valid values.")]
InvalidWhatsThisButton {
value: String,
},
#[error("The `ShowInTaskbar` value is invalid: '{value}'. Only 0 (Hide) or -1 (Show) are valid values.")]
InvalidShowInTaskbar {
value: String,
},
#[error("The `NegotiatePosition` value is invalid: '{value}'. Only 0 (None), 1 (Left), 2 (Middle), or 3 (Right) are valid values.")]
InvalidNegotiatePosition {
value: String,
},
#[error("The `ListBoxStyle` value is invalid: '{value}'. Only 0 (Standard) or 1 (Checkbox) are valid values.")]
InvalidListBoxStyle {
value: String,
},
#[error("The `AutoSize` value is invalid: '{value}'. Only 0 (Fixed) or -1 (Resize) are valid values.")]
InvalidAutoSize {
value: String,
},
#[error("The `AutoRedraw` value is invalid: '{value}'. Only 0 (Manual) or -1 (Automatic) are valid values.")]
InvalidAutoRedraw {
value: String,
},
#[error("The `TextAlign` value is invalid: '{value}'. Only 0 (LeftToRight) or -1 (RightToLeft) are valid values.")]
InvalidTextDirection {
value: String,
},
#[error("The `TabStop` value is invalid: '{value}'. Only 0 (ProgrammaticOnly) or -1 (Included) are valid values.")]
InvalidTabStop {
value: String,
},
#[error("The `Visibility` value is invalid: '{value}'. Only 0 (Hidden) or -1 (Visible) are valid values.")]
InvalidVisibility {
value: String,
},
#[error("The `HasDeviceContext` value is invalid: '{value}'. Only 0 (No) or -1 (Yes) are valid values.")]
InvalidHasDeviceContext {
value: String,
},
#[error("The `CausesValidation` value is invalid: '{value}'. Only 0 (No) or -1 (Yes) are valid values.")]
InvalidCausesValidation {
value: String,
},
#[error("The `Movability` value is invalid: '{value}'. Only 0 (Fixed) or -1 (Movable) are valid values.")]
InvalidMovability {
value: String,
},
#[error("The `FontTransparency` value is invalid: '{value}'. Only 0 (Opaque) or -1 (Transparent) are valid values.")]
InvalidFontTransparency {
value: String,
},
#[error("The `WhatsThisHelp` value is invalid: '{value}'. Only 0 (F1Help) or -1 (WhatsThisHelp) are valid values.")]
InvalidWhatsThisHelp {
value: String,
},
#[error("The `Activation` value is invalid: '{value}'. Only 0 (Disabled) or -1 (Enabled) are valid values.")]
InvalidActivation {
value: String,
},
#[error("The `LinkMode` value is invalid: '{value}'. Only 0 (None) or 1 (Source).")]
InvalidFormLinkMode {
value: String,
},
#[error("The `WindowState` value is invalid: '{value}'. Only 0 (Normal), 1 (Minimized), or 2 (Maximized) are valid values.")]
InvalidWindowState {
value: String,
},
#[error("The `Align` value is invalid: '{value}'. Only 0 (None), 1 (Top), 2 (Bottom), 3 (Left), or 4 (Right) are valid values.")]
InvalidAlign {
value: String,
},
#[error("The `Appearance` value is invalid: '{value}'. Only 0 (Flat) or 1 (ThreeD) are valid values.")]
InvalidAppearance {
value: String,
},
#[error("The `JustifyAlignment` value is invalid: '{value}'. Only 0 (Left), 1 (Right) are valid values.")]
InvalidJustifyAlignment {
value: String,
},
#[error("The `Alignment` value is invalid: '{value}'. Only 0 (Left), 1 (Center), or 2 (Right) are valid values.")]
InvalidAlignment {
value: String,
},
#[error("The `BackStyle` value is invalid: '{value}'. Only 0 (Transparent) or 1 (Opaque) are valid values.")]
InvalidBackStyle {
value: String,
},
#[error("The `BorderStyle` value is invalid: '{value}'. Only 0 (None) or 1 (FixedSingle) are valid values.")]
InvalidBorderStyle {
value: String,
},
#[error("The `DragMode` value is invalid: '{value}'. Only 0 (Manual) or 1 (Automatic) are valid values.")]
InvalidDragMode {
value: String,
},
#[error("The `DrawMode` value is invalid: '{value}'. Only 1 (Blackness), 2 (NotMergePen), 3 (MaskNotPen), 4 (NotCopyPen), 5 (MaskPenNot), 6 (Invert), 7 (XorPen), 8 (NotMaskPen), 9 (MaskPen), 10 (NotXorPen), 11 (Nop), 12 (MergeNotPen), 13 (CopyPen), 14 (MergePenNot), 15 (Merge Pen), or 16 (Whiteness) are valid values.")]
InvalidDrawMode {
value: String,
},
#[error("The `DrawStyle` value is invalid: '{value}'. Only 0 (Solid), 1 (Dash), 2 (Dot), 3 (DashDot), 4 (DashDotDot), 5 (Transparent), or 6 (InsideSolid) are valid values.")]
InvalidDrawStyle {
value: String,
},
#[error("The `MousePointer` value is invalid: '{value}'. Only 0 (Default), 1 (Arrow), 2 (Cross), 3 (IBeam), 4 (Icon), 5 (Size), 6 (SizeNESW), 7 (SizeNS), 8 (SizeNWSE), 9 (SizeWE), 10 (UpArrow), 11 (Hourglass), 12 (NoDrop), 13 (ArrowHourglass), 14 (ArrowQuestion), 15 (SizeAll), or 99 (Custom) are valid values.")]
InvalidMousePointer {
value: String,
},
#[error("The `OLEDragMode` value is invalid: '{value}'. Only 0 (Manual), or 1 (Automatic) are valid values.")]
InvalidOLEDragMode {
value: String,
},
#[error("The `OLEDropMode` value is invalid: '{value}'. Only 0 (None), or 1 (Manual) are valid values.")]
InvalidOLEDropMode {
value: String,
},
#[error("The `ClipControls` value is invalid: '{value}'. Only 0 (Unbounded) or 1 (Clipped) are valid values.")]
InvalidClipControls {
value: String,
},
#[error("The `Style` value is invalid: '{value}'. Only 0 (Standard) or 1 (Graphical) are valid values.")]
InvalidStyle {
value: String,
},
#[error("The `FillStyle` value is invalid: '{value}'. Only 0 (Solid), 1 (Transparent), 2 (HorizontalLine), 3 (VerticalLine), 4 (UpwardDiagonal), 5 (DownwardDiagonal), 6 (Cross), or 7 (DiagonalCross) are valid values.")]
InvalidFillStyle {
value: String,
},
#[error("The `LinkMode` value is invalid: '{value}'. Only 0 (None), 1 (Automatic), 2 (Manual), or 3 (Notify) are valid values.")]
InvalidLinkMode {
value: String,
},
#[error("The `MultiSelect` value is invalid: '{value}'. Only 0 (None), 1 (Simple), or 2 (Extended) are valid values.")]
InvalidMultiSelect {
value: String,
},
#[error("The `OLETypeAllowed` value is invalid: '{value}'. Only 0 (Link), 1 (Embedded), or 2 (Either) are valid values.")]
InvalidOLETypeAllowed {
value: String,
},
#[error("The `ScaleMode` value is invalid: '{value}'. Only 0 (User), 1 (Twips), 2 (Points), 3 (Pixels), 4 (Characters), 5 (Inches), 6 (Millimeters), 7 (Centimeters), 8 (HiMetric), 9 (ContainerPosition), 10 (ContainerSize) are valid values.")]
InvalidScaleMode {
value: String,
},
#[error("The `SizeMode` value is invalid: '{value}'. Only 0 (Clip), 1 (Stretch), 2 (AutoSize), or 3 (Zoom) are valid values.")]
InvalidSizeMode {
value: String,
},
#[error("The `OptionButtonValue` value is invalid: '{value}'. Only 0 (UnSelected), or 1 (Selected) are valid values.")]
InvalidOptionButtonValue {
value: String,
},
#[error("The `UpdateOptions` value is invalid: '{value}'. Only 0 (Automatic), 1 (Frozen), or 2 (Manual) are valid values.")]
InvalidUpdateOptions {
value: String,
},
#[error("The `AutoActivate` value is invalid: '{value}'. Only 0 (Manual), 1 (GetFocus), 2 (DoubleClick), or 3 (Automatic) are valid values.")]
InvalidAutoActivate {
value: String,
},
#[error("The `DisplayType` value is invalid: '{value}'. Only 0 (Content) or 1 (Icon) are valid values.")]
InvalidDisplayType {
value: String,
},
#[error("The `ScrollBars` value is invalid: '{value}'. Only 0 (None), 1 (Horizontal), 2 (Vertical), or 3 (Both) are valid values.")]
InvalidScrollBars {
value: String,
},
#[error("The `MultiLine` value is invalid: '{value}'. Only 0 (SingleLine) or -1 (MultiLine) are valid values.")]
InvalidMultiLine {
value: String,
},
#[error("The `Shape` value is invalid: '{value}'. Only 0 (Rectangle), 1 (Square), 2 (Oval), 3 (Circle), 4 (RoundedRectangle), or 5 (RoundSquare) are valid values.")]
InvalidShape {
value: String,
},
#[error("The 'VERSION' keyword is missing from the form file header.")]
VersionKeywordMissing,
#[error("The 'Begin' keyword is missing from the form file header.")]
BeginKeywordMissing,
#[error("The Form is missing from the form file header.")]
Missing,
#[error("Property parsing error")]
PropertyError,
#[error("Resource file parsing error: {message}")]
ResourceFileError {
message: String,
},
#[error("Error reading the source file: {message}")]
SourceFileError {
message: String,
},
#[error("The file contains more than a significant number of non-ASCII characters. This file was likely saved in a non-English character set. The vb6parse crate currently does not support non-english vb6 files.")]
LikelyNonEnglishCharacterSet,
#[error("The reference line has too many elements")]
ReferenceExtraSections,
#[error("The reference line has too few elements")]
ReferenceMissingSections,
#[error("The first line of a VB6 project file must be a project 'Type' entry.")]
FirstLineNotProject,
#[error("Line type is unknown.")]
LineTypeUnknown,
#[error("Project type is not Exe, OleDll, Control, or OleExe")]
ProjectTypeUnknown,
#[error("Project lacks a version number.")]
NoVersion,
#[error("Project parse error while processing an Object line.")]
NoObjects,
#[error("Form parse error. No Form found in form file.")]
NoForm,
#[error("Parse error while processing Form attributes.")]
AttributeParseError,
#[error("Parse error while attempting to parse Form tokens.")]
TokenParseError,
#[error("Project parse error, failure to find BEGIN element.")]
NoBegin,
#[error("Project line entry is not ended with a recognized line ending.")]
NoLineEnding,
#[error("Unable to parse the Uuid")]
UnableToParseUuid,
#[error("Unable to find a semicolon ';' in this line.")]
NoSemicolonSplit,
#[error("Unable to find an equal '=' in this line.")]
NoEqualSplit,
#[error("While trying to parse the offset into the resource file, no colon ':' was found.")]
NoColonForOffsetSplit,
#[error("No key value divider found in the line.")]
NoKeyValueDividerFound,
#[error("Unknown parser error")]
Unparsable,
#[error("Major version is not a number.")]
MajorVersionUnparsable,
#[error("Unable to parse hex address from DllBaseAddress key")]
DllBaseAddressUnparsable,
#[error("The Startup object is not a valid parameter. Must be a quoted startup method/object, \"(None)\", !(None)!, \"\", or \"!!\"")]
StartupUnparsable,
#[error("The Name parameter is invalid. Must be a quoted name, \"(None)\", !(None)!, \"\", or \"!!\"")]
NameUnparsable,
#[error("The CommandLine parameter is invalid. Must be a quoted command line, \"(None)\", !(None)!, \"\", or \"!!\"")]
CommandLineUnparsable,
#[error("The HelpContextId parameter is not a valid parameter line. Must be a quoted help context id, \"(None)\", !(None)!, \"\", or \"!!\"")]
HelpContextIdUnparsable,
#[error("Minor version is not a number.")]
MinorVersionUnparsable,
#[error("Revision version is not a number.")]
RevisionVersionUnparsable,
#[error("Unable to parse the value after ThreadingModel key")]
ThreadingModelUnparsable,
#[error("ThreadingModel can only be 0 (Apartment Threaded), or 1 (Single Threaded)")]
ThreadingModelInvalid,
#[error("No property name found after BeginProperty keyword.")]
NoPropertyName,
#[error("Unable to parse the RelatedDoc property line.")]
RelatedDocLineUnparsable,
#[error("AutoIncrement can only be a 0 (false) or a -1 (true)")]
AutoIncrementUnparsable,
#[error("CompatibilityMode can only be a 0 (CompatibilityMode::NoCompatibility), 1 (CompatibilityMode::Project), or 2 (CompatibilityMode::CompatibleExe)")]
CompatibilityModeUnparsable,
#[error("NoControlUpgrade can only be a 0 (UpgradeControls::Upgrade) or a 1 (UpgradeControls::NoUpgrade)")]
NoControlUpgradeUnparsable,
#[error("ServerSupportFiles can only be a 0 (false) or a -1 (true)")]
ServerSupportFilesUnparsable,
#[error("Comment line was unparsable")]
CommentUnparsable,
#[error("PropertyPage line was unparsable")]
PropertyPageUnparsable,
#[error("CompilationType can only be a 0 (false) or a -1 (true)")]
CompilationTypeUnparsable,
#[error("OptimizationType can only be a 0 (FastCode) or 1 (SmallCode), or 2 (NoOptimization)")]
OptimizationTypeUnparsable,
#[error("FavorPentiumPro(tm) can only be a 0 (false) or a -1 (true)")]
FavorPentiumProUnparsable,
#[error("Designer line is unparsable")]
DesignerLineUnparsable,
#[error("Form line is unparsable")]
FormLineUnparsable,
#[error("UserControl line is unparsable")]
UserControlLineUnparsable,
#[error("UserDocument line is unparsable")]
UserDocumentLineUnparsable,
#[error("Period expected in version number")]
PeriodExpectedInVersionNumber,
#[error("CodeViewDebugInfo can only be a 0 (false) or a -1 (true)")]
CodeViewDebugInfoUnparsable,
#[error("NoAliasing can only be a 0 (false) or a -1 (true)")]
NoAliasingUnparsable,
#[error("RemoveUnusedControlInfo can only be 0 (UnusedControlInfo::Retain) or -1 (UnusedControlInfo::Remove)")]
UnusedControlInfoUnparsable,
#[error("BoundsCheck can only be a 0 (false) or a -1 (true)")]
BoundsCheckUnparsable,
#[error("OverflowCheck can only be a 0 (false) or a -1 (true)")]
OverflowCheckUnparsable,
#[error("FlPointCheck can only be a 0 (false) or a -1 (true)")]
FlPointCheckUnparsable,
#[error("FDIVCheck can only be a 0 (PentiumFDivBugCheck::CheckPentiumFDivBug) or a -1 (PentiumFDivBugCheck::NoPentiumFDivBugCheck)")]
FDIVCheckUnparsable,
#[error("UnroundedFP can only be a 0 (UnroundedFloatingPoint::DoNotAllow) or a -1 (UnroundedFloatingPoint::Allow)")]
UnroundedFPUnparsable,
#[error("StartMode can only be a 0 (StartMode::StandAlone) or a 1 (StartMode::Automation)")]
StartModeUnparsable,
#[error("Unattended can only be a 0 (Unattended::False) or a -1 (Unattended::True)")]
UnattendedUnparsable,
#[error(
"Retained can only be a 0 (Retained::UnloadOnExit) or a 1 (Retained::RetainedInMemory)"
)]
RetainedUnparsable,
#[error("Unable to parse the ShortCut property.")]
ShortCutUnparsable,
#[error("DebugStartup can only be a 0 (false) or a -1 (true)")]
DebugStartupOptionUnparsable,
#[error("UseExistingBrowser can only be a 0 (UseExistingBrowser::DoNotUse) or a -1 (UseExistingBrowser::Use)")]
UseExistingBrowserUnparsable,
#[error("AutoRefresh can only be a 0 (false) or a -1 (true)")]
AutoRefreshUnparsable,
#[error("Thread Per Object is not a number.")]
ThreadPerObjectUnparsable,
#[error("Unknown attribute in class header file. Must be one of: VB_Name, VB_GlobalNameSpace, VB_Creatable, VB_PredeclaredId, VB_Exposed, VB_Description, VB_Ext_KEY")]
UnknownAttribute,
#[error("Error parsing header")]
Header,
#[error("No name in the attribute section of the VB6 file")]
MissingNameAttribute,
#[error("Keyword not found")]
KeywordNotFound,
#[error("Error parsing true/false from header. Must be a 0 (false), -1 (true), or 1 (true)")]
TrueFalseOneZeroNegOneUnparsable,
#[error("Error parsing the VB6 file contents")]
FileContent,
#[error("Max Threads is not a number.")]
MaxThreadsUnparsable,
#[error("No EndProperty found after BeginProperty")]
NoEndProperty,
#[error("No line ending after EndProperty")]
NoLineEndingAfterEndProperty,
#[error("Expected namespace after Begin keyword")]
NoNamespaceAfterBegin,
#[error("No dot found after namespace")]
NoDotAfterNamespace,
#[error("No User Control name found after namespace and '.'")]
NoUserControlNameAfterDot,
#[error("No space after Control kind")]
NoSpaceAfterControlKind,
#[error("No control name found after Control kind")]
NoControlNameAfterControlKind,
#[error("No line ending after Control name")]
NoLineEndingAfterControlName,
#[error("Unknown token")]
UnknownToken,
#[error("Title text was unparsable")]
TitleUnparsable,
#[error("Unable to parse hex color value")]
HexColorParseError,
#[error("Unknown control in control list")]
UnknownControlKind,
#[error("Property name is not a valid ASCII string")]
PropertyNameAsciiConversionError,
#[error("String is unterminated")]
UnterminatedString,
#[error("Unable to parse VB6 string.")]
StringParseError,
#[error("Property value is not a valid ASCII string")]
PropertyValueAsciiConversionError,
#[error("Key value pair format is incorrect")]
KeyValueParseError,
#[error("Namespace is not a valid ASCII string")]
NamespaceAsciiConversionError,
#[error("Control kind is not a valid ASCII string")]
ControlKindAsciiConversionError,
#[error("Qualified control name is not a valid ASCII string")]
QualifiedControlNameAsciiConversionError,
#[error("Variable names must be less than 255 characters in VB6.")]
VariableNameTooLong,
#[error("Invalid top-level control type: '{control_type}'. Form files must have either 'VB.Form' or 'VB.MDIForm' as the top-level element.")]
InvalidTopLevelControl {
control_type: String,
},
#[error("Internal Parser Error - please report this issue to the developers.")]
InternalParseError,
}