Add FinAppRepositoryError class with unit tests - #49
Conversation
- Introduced `FinAppRepositoryError` class extending `AppError` to standardize error handling for financial application repository errors. - Created `FinAppRepositoryError.test.ts` to validate the functionality of the new error class, ensuring proper message and name assignment. - Updated the index file to export the new error class. These additions enhance error management for the financial application and improve test coverage for error handling.
📝 WalkthroughWalkthroughA new error class, Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant FinAppRepositoryError
participant AppError
Caller->>FinAppRepositoryError: new FinAppRepositoryError(message)
FinAppRepositoryError->>AppError: super('FinAppRepositoryError', message)
AppError-->>FinAppRepositoryError: instance initialized
FinAppRepositoryError-->>Caller: error instance returned
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🔍 Vulnerabilities of
|
| digest | sha256:a943f1a4d37943952e27b64f52f56db50085e3da415417610415872c25d8e087 |
| vulnerabilities | |
| platform | linux/amd64 |
| size | 243 MB |
| packages | 1628 |
📦 Base Image node:20-alpine
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
workers/main/src/common/errors/FinAppRepositoryError.test.ts (1)
5-12: Add assertion for inheritance
Consider verifying thatFinAppRepositoryErrorinherits from bothAppErrorand the built-inErrorto ensure the prototype chain is correct.You can enhance the test as follows:
import { describe, expect, it } from 'vitest'; +import { AppError } from './AppError'; import { FinAppRepositoryError } from './FinAppRepositoryError'; describe('FinAppRepositoryError', () => { it('should set the message and name', () => { const err = new FinAppRepositoryError('test message'); expect(err.message).toBe('test message'); expect(err.name).toBe('FinAppRepositoryError'); + expect(err).toBeInstanceOf(AppError); + expect(err).toBeInstanceOf(Error); }); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
workers/main/src/common/errors/FinAppRepositoryError.test.ts(1 hunks)workers/main/src/common/errors/FinAppRepositoryError.ts(1 hunks)workers/main/src/common/errors/index.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
workers/main/src/common/errors/FinAppRepositoryError.ts (1)
workers/main/src/common/errors/AppError.ts (1)
AppError(1-9)
workers/main/src/common/errors/FinAppRepositoryError.test.ts (1)
workers/main/src/common/errors/FinAppRepositoryError.ts (1)
FinAppRepositoryError(3-7)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Docker Security Scanning (n8n, Dockerfile.n8n, n8n-test:latest)
- GitHub Check: Docker Security Scanning (temporal, Dockerfile.temporal, temporal-test:latest)
- GitHub Check: Service Availability Check
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
workers/main/src/common/errors/index.ts (1)
3-3: Export of FinAppRepositoryError
The new error class is correctly re-exported, making it available from the central errors module.workers/main/src/common/errors/FinAppRepositoryError.test.ts (1)
1-4: Imports structure is clear
Third-party (vitest) and local imports are separated by a blank line, improving readability and consistency.workers/main/src/common/errors/FinAppRepositoryError.ts (1)
1-7: Correct implementation of custom error class
FinAppRepositoryErrorproperly extendsAppError, passing the message and name through the superclass constructor and leveraging stack-trace capture.
3b7528a
|



FinAppRepositoryErrorclass extendingAppErrorto standardize error handling for financial application repository errors.FinAppRepositoryError.test.tsto validate the functionality of the new error class, ensuring proper message and name assignment.These additions enhance error management for the financial application and improve test coverage for error handling.