errors

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errors provides custom error types and utilities for the Skyline application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(err error, message string) error

Wrap enhances an existing error with additional context while preserving its type If the original error is nil, returns nil

Types

type ErrorType

type ErrorType string

ErrorType represents categories of errors that can occur in the application

const (
	ValidationError ErrorType = "VALIDATION" // Input validation errors
	IOError         ErrorType = "IO"         // File/network I/O errors
	NetworkError    ErrorType = "NETWORK"    // Network communication errors
	GraphQLError    ErrorType = "GRAPHQL"    // GitHub GraphQL API errors
	STLError        ErrorType = "STL"        // STL file generation errors
)

Predefined error types for consistent error categorization

type SkylineError

type SkylineError struct {
	Type    ErrorType // Category of the error
	Message string    // Human-readable error description
	Err     error     // Original error if wrapping another error
}

SkylineError provides structured error information including type and context

func New

func New(errType ErrorType, message string, err error) *SkylineError

New creates a new SkylineError with the specified type, message, and wrapped error

func (*SkylineError) Error

func (e *SkylineError) Error() string

Error implements the error interface for SkylineError

func (*SkylineError) Is

func (e *SkylineError) Is(target error) bool

Is implements error matching for SkylineError

func (*SkylineError) Unwrap

func (e *SkylineError) Unwrap() error

Unwrap implements error unwrapping for SkylineError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL