GithubHelp home page GithubHelp logo

teabyte / gooderror Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 0.0 6 KB

GoodError is a Python library that enhances exception handling, including integration with GPT-3 for additional context.

Python 100.00%
error-handler error-handling error-handling-python error-log error-logger error-logging error-monitoring errors better-errors debugging

gooderror's Introduction

Alt Text

GoodError Documentation

The GoodError library provides an improved exception handling mechanism in Python. It allows you to enhance the output of exceptions, including sending them to GPT-3 for additional context.

Installation

To install GoodError, use pip:

pip install gooderror

Example

Here's an example of how to use GoodError:

from gooderror import GoodError

GoodError()

x = "SADfsadf" + 5

# GoodError will enhance the exception output and will add COLORS!
# OUTPUT:
#<module>, TypeError(Can only concatenate str (not "int") to str)
#main, Line 82 -> m = "SADfsadf" + 5

Class: GoodError

The GoodError class provides the following attributes and methods:

Attributes

  • gpt_key (str): Your GPT API key.
  • use_colors (bool): Whether to use colors in the output.

GPT3.5 Usage

Import the GoodError class and initialize it with your GPT API key.

from gooderror import GoodError

# Initialize GoodError with your GPT API key
GoodError(gpt_key="YOUR_GPT_API_KEY")

result = 0/0

# OUTPUT:
#<module>, ZeroDivisionError(Division by zero)
#main, Line 80 -> result = 0/0

#Waiting for GPT to respond...

#The error "ZeroDivisionError" is raised when you try to divide a number by zero in Python. Division by zero is not defined in mathematics, hence this error is generated to indicate an invalid operation.
#To fix this error, you need to make sure you do not divide a number by zero. If the denominator can potentially be zero in your code, you can add a check to handle this scenario using an if condition. For example:

#try:
#    result = 0/0
#except ZeroDivisionError:
#    print("Cannot divide by zero")

#In this case, if the division operation encounters a ZeroDivisionError, it will be caught by the except block, which will then print the error message.

gooderror's People

Contributors

teabyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.