Skip to content

feat(error): Add validation error classes for YouTube ID and URL #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

mitsuki31
Copy link
Owner

Overview

This PR introduces three new error classes to improve the granularity and specificity of validation error handling for YouTube video IDs and URLs. These classes are part of the error module and are designed to provide clearer error messages and better debugging capabilities when validation fails.

Changes Made

Introduced New Error Classes

  • IDValidationError: Represents errors raised when a YouTube video ID fails validation.
  • URLValidationError: Represents errors raised when a YouTube video URL fails validation.
  • UnknownYouTubeDomainError: Represents errors raised when an invalid or unknown YouTube domain is detected.

Updated the error Module Exports

  • Exported the new error classes for use throughout the application.

Documentation Addition

  • Added @classdesc annotations for each new class, specifying its purpose and usage.

Impact

  • Improved Error Handling: Developers can now distinguish between different types of validation errors (e.g., invalid IDs, invalid URLs, or unrecognized domains).
  • Enhanced Debugging: By introducing these specific error types, debugging issues during YouTube-related validation processes becomes easier.
  • Better Code Organization: Each error is now explicitly defined, making the error-handling logic more readable and maintainable.

Summary

This PR enhances validation-related error handling for YouTube video IDs, URLs, and domains by introducing specific error classes. These improvements make error handling more precise and debugging easier, benefiting developers and users alike.

- Introduced new error classes for more specific validation error handling:
  - `IDValidationError`: Represents errors for invalid YouTube video IDs during validation.
  - `URLValidationError`: Represents errors for invalid YouTube video URLs during validation.
  - `UnknownYouTubeDomainError`: Represents errors due to invalid or unknown YouTube domains.

- Updated the `error` module to export the new error classes.

These additions provide better error handling and clarity for validation-related operations.
@mitsuki31 mitsuki31 added this to the YTMP3-JS v2.0.0 milestone Jan 13, 2025
@mitsuki31 mitsuki31 added feature Bring new features minor Minor changes labels Jan 13, 2025
@mitsuki31 mitsuki31 self-assigned this Jan 13, 2025
@mitsuki31 mitsuki31 merged commit 3ea5750 into master Jan 13, 2025
18 checks passed
@mitsuki31 mitsuki31 deleted the feat/add-validation-error-classes branch January 13, 2025 16:05
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.49%. Comparing base (38c166a) to head (055d264).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #91   +/-   ##
=======================================
  Coverage   80.49%   80.49%           
=======================================
  Files          11       11           
  Lines         605      605           
=======================================
  Hits          487      487           
  Misses        118      118           
Flag Coverage Δ
Ubuntu 80.49% <ø> (ø)
Windows 80.16% <ø> (ø)
all 80.49% <ø> (ø)
macOS 80.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Bring new features minor Minor changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant