Skip to content

Commit c8d3bde

Browse files
authored
Merge pull request #1 from veracode/addErrorMessage
add long error messages
2 parents 6157e93 + 49f6422 commit c8d3bde

File tree

3 files changed

+155
-116
lines changed

3 files changed

+155
-116
lines changed

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,25 @@ The wrapper uses a standardized exit code system to categorize different types o
113113

114114
Patterns are defined in `patterns.conf` using the format:
115115
```
116-
CATEGORY_NAME|pattern_regex|exit_code
116+
CATEGORY_NAME|pattern_regex|exit_code|error_message
117117
```
118118

119119
### Example Patterns
120120
```
121-
AUTH_INVALID_CREDENTIALS|401|210
122-
AUTH_INVALID_CREDENTIALS|unauthorized|210
123-
PKG_ARTIFACT_NOT_FOUND|file not found|240
124-
ENGINE_PARSER_ERROR|parse error|250
121+
AUTH_INVALID_CREDENTIALS|401|210|Authentication failed with HTTP 401 Unauthorized. Please verify your Veracode API credentials are correct and have not expired.
122+
AUTH_INVALID_CREDENTIALS|unauthorized|210|Unauthorized access detected. Please verify your Veracode API credentials are correct and have not expired.
123+
PKG_ARTIFACT_NOT_FOUND|file not found|240|File not found. The specified file could not be located. Please verify the file path and ensure the artifact exists.
124+
ENGINE_PARSER_ERROR|parse error|250|Parser error detected. The Veracode engine encountered an error while parsing the code. This may indicate syntax issues or unsupported code constructs.
125125
```
126126

127+
### Error Message Field
128+
129+
The fourth field contains a detailed error message that will be displayed in the analysis summary when a pattern is matched. These messages provide:
130+
- Clear description of the issue
131+
- Specific guidance on how to resolve the problem
132+
- Context about what the error means
133+
- Recommended next steps
134+
127135
## How It Works
128136

129137
1. **Command Execution**: The wrapper executes the provided command and captures its output
@@ -134,7 +142,34 @@ ENGINE_PARSER_ERROR|parse error|250
134142
4. **Exit Code Determination**:
135143
- Uses original exit code if no patterns match
136144
- Uses logical exit code from pattern matching if patterns are found
137-
5. **Output Display**: Shows command output, analysis summary, and final exit code
145+
5. **Output Display**: Shows command output, analysis summary with detailed error messages, and final exit code
146+
147+
## Analysis Summary Output
148+
149+
When a pattern is matched, the wrapper displays a comprehensive analysis summary:
150+
151+
```
152+
----------------------------------------
153+
[WRAPPER] INFO: ANALYSIS SUMMARY
154+
----------------------------------------
155+
Original command exit code: 0
156+
Pattern matched: AUTH_INVALID_CREDENTIALS
157+
Pattern regex: invalid.*credential
158+
Match count: 1
159+
Logical exit code: 210
160+
Error message: Invalid API credentials detected. Please verify your Veracode API ID and API Key are correct and have not expired. Check your credentials in the Veracode platform and update your configuration.
161+
Reason: Pattern 'AUTH_INVALID_CREDENTIALS' found in command output
162+
----------------------------------------
163+
```
164+
165+
The summary includes:
166+
- **Original command exit code**: The exit code from the wrapped command
167+
- **Pattern matched**: The name of the matched pattern
168+
- **Pattern regex**: The regular expression that matched
169+
- **Match count**: Number of times the pattern was found
170+
- **Logical exit code**: The standardized exit code (201-254)
171+
- **Error message**: Detailed explanation and guidance
172+
- **Reason**: Brief explanation of why this exit code was chosen
138173

139174
## CI/CD Integration
140175

0 commit comments

Comments
 (0)