@cloudstreamsoftware/claude-tools 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -37
- package/agents/INDEX.md +183 -0
- package/agents/architect.md +247 -0
- package/agents/build-error-resolver.md +555 -0
- package/agents/catalyst-deployer.md +132 -0
- package/agents/code-reviewer.md +121 -0
- package/agents/compliance-auditor.md +148 -0
- package/agents/creator-architect.md +395 -0
- package/agents/deluge-reviewer.md +98 -0
- package/agents/doc-updater.md +471 -0
- package/agents/e2e-runner.md +711 -0
- package/agents/planner.md +122 -0
- package/agents/refactor-cleaner.md +309 -0
- package/agents/security-reviewer.md +582 -0
- package/agents/tdd-guide.md +302 -0
- package/config/versions.json +63 -0
- package/dist/hooks/hooks.json +209 -0
- package/dist/index.js +47 -0
- package/dist/lib/asset-value.js +609 -0
- package/dist/lib/client-manager.js +300 -0
- package/dist/lib/command-matcher.js +242 -0
- package/dist/lib/cross-session-patterns.js +754 -0
- package/dist/lib/intent-classifier.js +1075 -0
- package/dist/lib/package-manager.js +374 -0
- package/dist/lib/recommendation-engine.js +597 -0
- package/dist/lib/session-memory.js +489 -0
- package/dist/lib/skill-effectiveness.js +486 -0
- package/dist/lib/skill-matcher.js +595 -0
- package/dist/lib/tutorial-metrics.js +242 -0
- package/dist/lib/tutorial-progress.js +209 -0
- package/dist/lib/tutorial-renderer.js +431 -0
- package/dist/lib/utils.js +380 -0
- package/dist/lib/verify-formatter.js +143 -0
- package/dist/lib/workflow-state.js +249 -0
- package/hooks/hooks.json +209 -0
- package/package.json +5 -1
- package/scripts/aggregate-sessions.js +290 -0
- package/scripts/branch-name-validator.js +291 -0
- package/scripts/build.js +101 -0
- package/scripts/commands/client-switch.js +231 -0
- package/scripts/deprecate-skill.js +610 -0
- package/scripts/diagnose.js +324 -0
- package/scripts/doc-freshness.js +168 -0
- package/scripts/generate-weekly-digest.js +393 -0
- package/scripts/health-check.js +270 -0
- package/scripts/hooks/credential-check.js +101 -0
- package/scripts/hooks/evaluate-session.js +81 -0
- package/scripts/hooks/pre-compact.js +66 -0
- package/scripts/hooks/prompt-analyzer.js +276 -0
- package/scripts/hooks/prompt-router.js +422 -0
- package/scripts/hooks/quality-gate-enforcer.js +371 -0
- package/scripts/hooks/session-end.js +156 -0
- package/scripts/hooks/session-start.js +195 -0
- package/scripts/hooks/skill-injector.js +333 -0
- package/scripts/hooks/suggest-compact.js +58 -0
- package/scripts/lib/asset-value.js +609 -0
- package/scripts/lib/client-manager.js +300 -0
- package/scripts/lib/command-matcher.js +242 -0
- package/scripts/lib/cross-session-patterns.js +754 -0
- package/scripts/lib/intent-classifier.js +1075 -0
- package/scripts/lib/package-manager.js +374 -0
- package/scripts/lib/recommendation-engine.js +597 -0
- package/scripts/lib/session-memory.js +489 -0
- package/scripts/lib/skill-effectiveness.js +486 -0
- package/scripts/lib/skill-matcher.js +595 -0
- package/scripts/lib/tutorial-metrics.js +242 -0
- package/scripts/lib/tutorial-progress.js +209 -0
- package/scripts/lib/tutorial-renderer.js +431 -0
- package/scripts/lib/utils.js +380 -0
- package/scripts/lib/verify-formatter.js +143 -0
- package/scripts/lib/workflow-state.js +249 -0
- package/scripts/onboard.js +363 -0
- package/scripts/quarterly-report.js +692 -0
- package/scripts/setup-package-manager.js +204 -0
- package/scripts/sync-upstream.js +391 -0
- package/scripts/test.js +108 -0
- package/scripts/tutorial-runner.js +351 -0
- package/scripts/validate-all.js +201 -0
- package/scripts/verifiers/agents.js +245 -0
- package/scripts/verifiers/config.js +186 -0
- package/scripts/verifiers/environment.js +123 -0
- package/scripts/verifiers/hooks.js +188 -0
- package/scripts/verifiers/index.js +38 -0
- package/scripts/verifiers/persistence.js +140 -0
- package/scripts/verifiers/plugin.js +215 -0
- package/scripts/verifiers/skills.js +209 -0
- package/scripts/verify-setup.js +164 -0
- package/skills/INDEX.md +157 -0
- package/skills/backend-patterns/SKILL.md +586 -0
- package/skills/backend-patterns/catalyst-patterns.md +128 -0
- package/skills/bigquery-patterns/SKILL.md +27 -0
- package/skills/bigquery-patterns/performance-optimization.md +518 -0
- package/skills/bigquery-patterns/query-patterns.md +372 -0
- package/skills/bigquery-patterns/schema-design.md +78 -0
- package/skills/cloudstream-project-template/SKILL.md +20 -0
- package/skills/cloudstream-project-template/structure.md +65 -0
- package/skills/coding-standards/SKILL.md +524 -0
- package/skills/coding-standards/deluge-standards.md +83 -0
- package/skills/compliance-patterns/SKILL.md +28 -0
- package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
- package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
- package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
- package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
- package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
- package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
- package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
- package/skills/compliance-patterns/soc2/access-controls.md +344 -0
- package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
- package/skills/compliance-patterns/soc2/change-management.md +403 -0
- package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
- package/skills/consultancy-workflows/SKILL.md +19 -0
- package/skills/consultancy-workflows/client-isolation.md +21 -0
- package/skills/consultancy-workflows/documentation-automation.md +454 -0
- package/skills/consultancy-workflows/handoff-procedures.md +257 -0
- package/skills/consultancy-workflows/knowledge-capture.md +513 -0
- package/skills/consultancy-workflows/time-tracking.md +26 -0
- package/skills/continuous-learning/SKILL.md +84 -0
- package/skills/continuous-learning/config.json +18 -0
- package/skills/continuous-learning/evaluate-session.sh +60 -0
- package/skills/continuous-learning-v2/SKILL.md +126 -0
- package/skills/continuous-learning-v2/config.json +61 -0
- package/skills/frontend-patterns/SKILL.md +635 -0
- package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
- package/skills/gcp-data-engineering/SKILL.md +36 -0
- package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
- package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
- package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
- package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
- package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
- package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
- package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
- package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
- package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
- package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
- package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
- package/skills/security-review/SKILL.md +498 -0
- package/skills/security-review/compliance-checklist.md +53 -0
- package/skills/strategic-compact/SKILL.md +67 -0
- package/skills/tdd-workflow/SKILL.md +413 -0
- package/skills/tdd-workflow/zoho-testing.md +124 -0
- package/skills/tutorial/SKILL.md +249 -0
- package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
- package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
- package/skills/tutorial/lessons/01-basics.md +81 -0
- package/skills/tutorial/lessons/02-training.md +86 -0
- package/skills/tutorial/lessons/03-commands.md +109 -0
- package/skills/tutorial/lessons/04-workflows.md +115 -0
- package/skills/tutorial/lessons/05-compliance.md +116 -0
- package/skills/tutorial/lessons/06-zoho.md +121 -0
- package/skills/tutorial/lessons/07-hooks-system.md +277 -0
- package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
- package/skills/tutorial/lessons/09-client-management.md +215 -0
- package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
- package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
- package/skills/tutorial/lessons/12-rules-system.md +326 -0
- package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
- package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
- package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
- package/skills/tutorial/tracks/accelerated/README.md +134 -0
- package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
- package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
- package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
- package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
- package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
- package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
- package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
- package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
- package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
- package/skills/zoho-patterns/CHANGELOG.md +108 -0
- package/skills/zoho-patterns/SKILL.md +446 -0
- package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
- package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
- package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
- package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
- package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
- package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
- package/skills/zoho-patterns/creator/form-design.md +304 -0
- package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
- package/skills/zoho-patterns/creator/widget-integration.md +306 -0
- package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
- package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
- package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
- package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
- package/skills/zoho-patterns/deluge/error-handling.md +423 -0
- package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
- package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
- package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
- package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
- package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
# Deluge Error Handling
|
|
2
|
+
|
|
3
|
+
## Structured Error Response Pattern
|
|
4
|
+
|
|
5
|
+
All custom functions should return consistent error structures:
|
|
6
|
+
|
|
7
|
+
```deluge
|
|
8
|
+
// Standard response format
|
|
9
|
+
successResponse = Map();
|
|
10
|
+
successResponse.put("status", "success");
|
|
11
|
+
successResponse.put("message", "Operation completed");
|
|
12
|
+
successResponse.put("data", resultData);
|
|
13
|
+
return successResponse;
|
|
14
|
+
|
|
15
|
+
errorResponse = Map();
|
|
16
|
+
errorResponse.put("status", "error");
|
|
17
|
+
errorResponse.put("message", "Human-readable error description");
|
|
18
|
+
errorResponse.put("code", "ERR_VALIDATION_FAILED");
|
|
19
|
+
errorResponse.put("data", null);
|
|
20
|
+
return errorResponse;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Response Structure
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"status": "success | error | warning",
|
|
28
|
+
"message": "Human-readable description",
|
|
29
|
+
"code": "MACHINE_READABLE_ERROR_CODE",
|
|
30
|
+
"data": {},
|
|
31
|
+
"errors": [],
|
|
32
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Try-Catch Patterns
|
|
37
|
+
|
|
38
|
+
### Basic Try-Catch
|
|
39
|
+
|
|
40
|
+
```deluge
|
|
41
|
+
try
|
|
42
|
+
{
|
|
43
|
+
result = zoho.crm.getRecordById("Deals", dealId);
|
|
44
|
+
if (result == null)
|
|
45
|
+
{
|
|
46
|
+
return {"status": "error", "code": "NOT_FOUND", "message": "Deal not found: " + dealId};
|
|
47
|
+
}
|
|
48
|
+
return {"status": "success", "data": result};
|
|
49
|
+
}
|
|
50
|
+
catch (e)
|
|
51
|
+
{
|
|
52
|
+
return {"status": "error", "code": "SYSTEM_ERROR", "message": e.toString()};
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Nested Try-Catch (Multiple Operations)
|
|
57
|
+
|
|
58
|
+
```deluge
|
|
59
|
+
// When one operation depends on another
|
|
60
|
+
try
|
|
61
|
+
{
|
|
62
|
+
// Step 1: Fetch customer
|
|
63
|
+
customer = zoho.crm.getRecordById("Contacts", contactId);
|
|
64
|
+
if (customer == null)
|
|
65
|
+
{
|
|
66
|
+
return {"status": "error", "code": "CUSTOMER_NOT_FOUND", "message": "Contact " + contactId + " not found"};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Step 2: Create invoice (separate try-catch for different error handling)
|
|
70
|
+
try
|
|
71
|
+
{
|
|
72
|
+
invoice = zoho.books.createRecord("invoices", orgId, invoiceData, "books-connection");
|
|
73
|
+
if (invoice.get("code") != 0)
|
|
74
|
+
{
|
|
75
|
+
return {"status": "error", "code": "BOOKS_ERROR", "message": invoice.get("message")};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (booksError)
|
|
79
|
+
{
|
|
80
|
+
return {"status": "error", "code": "BOOKS_UNAVAILABLE", "message": "Books API error: " + booksError.toString()};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Step 3: Update CRM with invoice reference
|
|
84
|
+
try
|
|
85
|
+
{
|
|
86
|
+
zoho.crm.updateRecord("Contacts", contactId, {"Last_Invoice_ID": invoice.get("invoice").get("invoice_id")});
|
|
87
|
+
}
|
|
88
|
+
catch (crmError)
|
|
89
|
+
{
|
|
90
|
+
// Non-critical failure - log but don't fail the whole operation
|
|
91
|
+
info "Warning: CRM update failed: " + crmError.toString();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {"status": "success", "data": {"invoice_id": invoice.get("invoice").get("invoice_id")}};
|
|
95
|
+
}
|
|
96
|
+
catch (e)
|
|
97
|
+
{
|
|
98
|
+
return {"status": "error", "code": "UNEXPECTED", "message": e.toString()};
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Logging to Custom Form
|
|
103
|
+
|
|
104
|
+
### Error Log Form Structure
|
|
105
|
+
|
|
106
|
+
| Field | Type | Purpose |
|
|
107
|
+
|-------|------|---------|
|
|
108
|
+
| Error_Code | Text | Machine-readable code |
|
|
109
|
+
| Error_Message | Multi-line | Human-readable description |
|
|
110
|
+
| Source_Function | Text | Which function generated the error |
|
|
111
|
+
| Source_Record_ID | Text | Related record if applicable |
|
|
112
|
+
| Stack_Trace | Multi-line | Full error details |
|
|
113
|
+
| Severity | Dropdown | Critical, Error, Warning, Info |
|
|
114
|
+
| Timestamp | DateTime | When the error occurred |
|
|
115
|
+
| User | Text | Who triggered the action |
|
|
116
|
+
| Resolution | Multi-line | How it was fixed (filled later) |
|
|
117
|
+
| Resolved | Decision Box | Whether issue is resolved |
|
|
118
|
+
|
|
119
|
+
### Logging Function
|
|
120
|
+
|
|
121
|
+
```deluge
|
|
122
|
+
// Custom function: logError(code, message, source, severity, recordId)
|
|
123
|
+
logMap = Map();
|
|
124
|
+
logMap.put("Error_Code", code);
|
|
125
|
+
logMap.put("Error_Message", message);
|
|
126
|
+
logMap.put("Source_Function", source);
|
|
127
|
+
logMap.put("Severity", severity);
|
|
128
|
+
logMap.put("Source_Record_ID", if(recordId != null, recordId.toString(), ""));
|
|
129
|
+
logMap.put("Timestamp", zoho.currenttime);
|
|
130
|
+
logMap.put("User", zoho.loginuserid);
|
|
131
|
+
logMap.put("Resolved", false);
|
|
132
|
+
|
|
133
|
+
try
|
|
134
|
+
{
|
|
135
|
+
zoho.creator.createRecord("admin-app", "Error_Logs", logMap);
|
|
136
|
+
}
|
|
137
|
+
catch (logError)
|
|
138
|
+
{
|
|
139
|
+
// If even logging fails, use info as last resort
|
|
140
|
+
info "CRITICAL: Error logging failed. Original error: " + code + " - " + message;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Usage in Workflows
|
|
145
|
+
|
|
146
|
+
```deluge
|
|
147
|
+
try
|
|
148
|
+
{
|
|
149
|
+
// Business logic here
|
|
150
|
+
processInvoice(input);
|
|
151
|
+
}
|
|
152
|
+
catch (e)
|
|
153
|
+
{
|
|
154
|
+
// Log the error
|
|
155
|
+
logError(
|
|
156
|
+
"INVOICE_PROCESS_FAIL",
|
|
157
|
+
e.toString(),
|
|
158
|
+
"Invoice_OnCreate_Workflow",
|
|
159
|
+
"Error",
|
|
160
|
+
input.ID
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
// Also notify if critical
|
|
164
|
+
if (input.Amount > 10000)
|
|
165
|
+
{
|
|
166
|
+
notifyAdmin("Critical invoice processing failure", e.toString(), input.ID);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Admin Notification Patterns
|
|
172
|
+
|
|
173
|
+
### Email Notification
|
|
174
|
+
|
|
175
|
+
```deluge
|
|
176
|
+
// Custom function: notifyAdmin(subject, details, recordId)
|
|
177
|
+
body = "<h3>Error Alert</h3>";
|
|
178
|
+
body = body + "<p><strong>Time:</strong> " + zoho.currenttime + "</p>";
|
|
179
|
+
body = body + "<p><strong>Record:</strong> " + recordId + "</p>";
|
|
180
|
+
body = body + "<p><strong>Details:</strong></p><pre>" + details + "</pre>";
|
|
181
|
+
body = body + "<p><a href='https://creator.zoho.com/app/admin-app#Form:Error_Logs'>View Error Logs</a></p>";
|
|
182
|
+
|
|
183
|
+
sendmail [
|
|
184
|
+
from: zoho.adminuserid
|
|
185
|
+
to: "admin@company.com"
|
|
186
|
+
subject: "[ERROR] " + subject
|
|
187
|
+
message: body
|
|
188
|
+
content_type: html
|
|
189
|
+
];
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Cliq Notification (Instant)
|
|
193
|
+
|
|
194
|
+
```deluge
|
|
195
|
+
// Post to Zoho Cliq channel for real-time alerts
|
|
196
|
+
cliqMessage = Map();
|
|
197
|
+
cliqMessage.put("text", "*Error Alert*\n" + subject + "\n```" + details + "```");
|
|
198
|
+
|
|
199
|
+
try
|
|
200
|
+
{
|
|
201
|
+
postToCliq = invokeUrl [
|
|
202
|
+
url: "https://cliq.zoho.com/api/v2/channelsbyname/error-alerts/message"
|
|
203
|
+
type: POST
|
|
204
|
+
headers: {"Content-Type": "application/json"}
|
|
205
|
+
body: cliqMessage.toString()
|
|
206
|
+
connection: "zoho-cliq-connection"
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
catch (cliqError)
|
|
210
|
+
{
|
|
211
|
+
info "Cliq notification failed: " + cliqError.toString();
|
|
212
|
+
// Fall back to email
|
|
213
|
+
sendmail [
|
|
214
|
+
from: zoho.adminuserid
|
|
215
|
+
to: "admin@company.com"
|
|
216
|
+
subject: "[ERROR] " + subject
|
|
217
|
+
message: details
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Error Categorization
|
|
223
|
+
|
|
224
|
+
```deluge
|
|
225
|
+
// Categorize errors for appropriate handling
|
|
226
|
+
function categorizeError(errorString)
|
|
227
|
+
{
|
|
228
|
+
if (errorString.contains("timeout") || errorString.contains("timed out"))
|
|
229
|
+
{
|
|
230
|
+
return "TIMEOUT";
|
|
231
|
+
}
|
|
232
|
+
else if (errorString.contains("401") || errorString.contains("unauthorized"))
|
|
233
|
+
{
|
|
234
|
+
return "AUTH_FAILURE";
|
|
235
|
+
}
|
|
236
|
+
else if (errorString.contains("429") || errorString.contains("rate limit"))
|
|
237
|
+
{
|
|
238
|
+
return "RATE_LIMITED";
|
|
239
|
+
}
|
|
240
|
+
else if (errorString.contains("404") || errorString.contains("not found"))
|
|
241
|
+
{
|
|
242
|
+
return "NOT_FOUND";
|
|
243
|
+
}
|
|
244
|
+
else if (errorString.contains("500") || errorString.contains("internal server"))
|
|
245
|
+
{
|
|
246
|
+
return "EXTERNAL_SERVER_ERROR";
|
|
247
|
+
}
|
|
248
|
+
else if (errorString.contains("null") || errorString.contains("NullPointer"))
|
|
249
|
+
{
|
|
250
|
+
return "NULL_REFERENCE";
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
{
|
|
254
|
+
return "UNKNOWN";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Usage
|
|
259
|
+
try
|
|
260
|
+
{
|
|
261
|
+
response = invokeUrl [ url: apiUrl type: GET connection: "conn" ];
|
|
262
|
+
}
|
|
263
|
+
catch (e)
|
|
264
|
+
{
|
|
265
|
+
category = categorizeError(e.toString());
|
|
266
|
+
|
|
267
|
+
if (category == "TIMEOUT" || category == "RATE_LIMITED" || category == "EXTERNAL_SERVER_ERROR")
|
|
268
|
+
{
|
|
269
|
+
// Transient - safe to retry
|
|
270
|
+
logError(category, e.toString(), "api_call", "Warning", null);
|
|
271
|
+
}
|
|
272
|
+
else if (category == "AUTH_FAILURE")
|
|
273
|
+
{
|
|
274
|
+
// Critical - needs human intervention
|
|
275
|
+
logError(category, e.toString(), "api_call", "Critical", null);
|
|
276
|
+
notifyAdmin("Connection auth failure - reauthorization needed", e.toString(), null);
|
|
277
|
+
}
|
|
278
|
+
else
|
|
279
|
+
{
|
|
280
|
+
// Log for investigation
|
|
281
|
+
logError(category, e.toString(), "api_call", "Error", null);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Graceful Degradation
|
|
287
|
+
|
|
288
|
+
```deluge
|
|
289
|
+
// When a non-critical external service fails, continue with defaults
|
|
290
|
+
function getExchangeRate(currency)
|
|
291
|
+
{
|
|
292
|
+
try
|
|
293
|
+
{
|
|
294
|
+
response = invokeUrl [
|
|
295
|
+
url: "https://api.exchangerate.com/latest/" + currency
|
|
296
|
+
type: GET
|
|
297
|
+
connection: "exchange-rate-connection"
|
|
298
|
+
];
|
|
299
|
+
return response.toJSON().get("rates").get("USD").toDecimal();
|
|
300
|
+
}
|
|
301
|
+
catch (e)
|
|
302
|
+
{
|
|
303
|
+
// Graceful degradation: use last known rate from cache
|
|
304
|
+
cachedRates = zoho.creator.getRecords("admin-app", "Exchange_Rates",
|
|
305
|
+
"Currency == \"" + currency + "\"", 1, 1);
|
|
306
|
+
|
|
307
|
+
if (cachedRates.size() > 0)
|
|
308
|
+
{
|
|
309
|
+
info "Using cached exchange rate for " + currency;
|
|
310
|
+
return cachedRates.get(0).get("Rate").toDecimal();
|
|
311
|
+
}
|
|
312
|
+
else
|
|
313
|
+
{
|
|
314
|
+
info "No cached rate available, using 1.0 default for " + currency;
|
|
315
|
+
return 1.0;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## User-Facing vs Internal Errors
|
|
322
|
+
|
|
323
|
+
```deluge
|
|
324
|
+
// Never expose internal details to end users
|
|
325
|
+
try
|
|
326
|
+
{
|
|
327
|
+
result = processOrder(input);
|
|
328
|
+
return {"status": "success", "message": "Your order has been submitted successfully."};
|
|
329
|
+
}
|
|
330
|
+
catch (e)
|
|
331
|
+
{
|
|
332
|
+
// Internal: Full error details for debugging
|
|
333
|
+
logError("ORDER_FAIL", e.toString(), "processOrder", "Error", input.ID);
|
|
334
|
+
|
|
335
|
+
// User-facing: Friendly message only
|
|
336
|
+
errorCategory = categorizeError(e.toString());
|
|
337
|
+
|
|
338
|
+
userMessage = "";
|
|
339
|
+
if (errorCategory == "TIMEOUT")
|
|
340
|
+
{
|
|
341
|
+
userMessage = "The system is experiencing delays. Please try again in a few minutes.";
|
|
342
|
+
}
|
|
343
|
+
else if (errorCategory == "AUTH_FAILURE")
|
|
344
|
+
{
|
|
345
|
+
userMessage = "There was a configuration issue. Our team has been notified.";
|
|
346
|
+
}
|
|
347
|
+
else
|
|
348
|
+
{
|
|
349
|
+
userMessage = "An unexpected error occurred. Please contact support with reference: " + input.ID;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return {"status": "error", "message": userMessage};
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Validation Error Pattern
|
|
357
|
+
|
|
358
|
+
```deluge
|
|
359
|
+
// Collect all validation errors before failing
|
|
360
|
+
function validateInvoice(input)
|
|
361
|
+
{
|
|
362
|
+
errors = List();
|
|
363
|
+
|
|
364
|
+
if (input.Customer_Name == null || input.Customer_Name == "")
|
|
365
|
+
{
|
|
366
|
+
errors.add("Customer name is required");
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (input.Amount == null || input.Amount <= 0)
|
|
370
|
+
{
|
|
371
|
+
errors.add("Amount must be greater than zero");
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (input.Due_Date != null && input.Due_Date < zoho.currentdate)
|
|
375
|
+
{
|
|
376
|
+
errors.add("Due date cannot be in the past");
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (input.Line_Items == null || input.Line_Items.size() == 0)
|
|
380
|
+
{
|
|
381
|
+
errors.add("At least one line item is required");
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (input.Line_Items != null && input.Line_Items.size() > 200)
|
|
385
|
+
{
|
|
386
|
+
errors.add("Cannot exceed 200 line items (subform limit)");
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (errors.size() > 0)
|
|
390
|
+
{
|
|
391
|
+
return {
|
|
392
|
+
"status": "error",
|
|
393
|
+
"code": "VALIDATION_FAILED",
|
|
394
|
+
"message": "Validation failed with " + errors.size() + " error(s)",
|
|
395
|
+
"errors": errors
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return {"status": "success"};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Usage
|
|
403
|
+
validation = validateInvoice(input);
|
|
404
|
+
if (validation.get("status") == "error")
|
|
405
|
+
{
|
|
406
|
+
alert validation.get("errors").toString("\n");
|
|
407
|
+
cancel submit;
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Error Monitoring Dashboard Query
|
|
412
|
+
|
|
413
|
+
Create a report in Creator with this criteria for monitoring:
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
Severity == "Critical" && Resolved == false && Timestamp >= zoho.currentdate.subDay(7)
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Key metrics to track:
|
|
420
|
+
- Error count by category (last 7 days)
|
|
421
|
+
- Mean time to resolution
|
|
422
|
+
- Top 5 error sources
|
|
423
|
+
- Unresolved critical errors (alert if > 0)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Deluge Quick Reference
|
|
2
|
+
|
|
3
|
+
## Data Types
|
|
4
|
+
- TEXT, NUMBER, DECIMAL, BOOLEAN, DATE, DATETIME
|
|
5
|
+
- LIST, MAP, FILE, JSON
|
|
6
|
+
|
|
7
|
+
## Common Operations
|
|
8
|
+
|
|
9
|
+
### Record Operations
|
|
10
|
+
```deluge
|
|
11
|
+
// Create
|
|
12
|
+
newRecord = zoho.creator.createRecord("app", "Form_Name", dataMap);
|
|
13
|
+
|
|
14
|
+
// Read (with pagination)
|
|
15
|
+
records = zoho.creator.getRecords("app", "Report_Name", criteria, 1, 200);
|
|
16
|
+
|
|
17
|
+
// Update
|
|
18
|
+
zoho.creator.updateRecord("app", "Form_Name", recordId, updateMap);
|
|
19
|
+
|
|
20
|
+
// Delete
|
|
21
|
+
zoho.creator.deleteRecord("app", "Form_Name", recordId);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### CRM Operations
|
|
25
|
+
```deluge
|
|
26
|
+
// Get records
|
|
27
|
+
records = zoho.crm.getRecords("Contacts", criteria, 1, 200);
|
|
28
|
+
|
|
29
|
+
// Create record
|
|
30
|
+
newId = zoho.crm.createRecord("Deals", dataMap);
|
|
31
|
+
|
|
32
|
+
// Search
|
|
33
|
+
results = zoho.crm.searchRecords("Contacts", "(Email:equals:" + email + ")");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### String Operations
|
|
37
|
+
```deluge
|
|
38
|
+
str.contains("search")
|
|
39
|
+
str.startsWith("prefix")
|
|
40
|
+
str.length()
|
|
41
|
+
str.toUpperCase()
|
|
42
|
+
str.replaceAll("old", "new")
|
|
43
|
+
str.getPrefix(",") // Before first comma
|
|
44
|
+
str.getSuffix(",") // After first comma
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### List Operations
|
|
48
|
+
```deluge
|
|
49
|
+
list.add(item)
|
|
50
|
+
list.remove(index)
|
|
51
|
+
list.size()
|
|
52
|
+
list.get(index)
|
|
53
|
+
list.contains(item)
|
|
54
|
+
list.sort(true) // ascending
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Map Operations
|
|
58
|
+
```deluge
|
|
59
|
+
map.put("key", value)
|
|
60
|
+
map.get("key")
|
|
61
|
+
map.containsKey("key")
|
|
62
|
+
map.keys()
|
|
63
|
+
map.values()
|
|
64
|
+
map.size()
|
|
65
|
+
```
|