Skip to main content

python error class is, to make it simple structure

Project description

smileerror

version 1.0.1

To make it a standard structure

# external library
from smileerror.ErrorBase import ErrorBase
# or pypi
#from ErrorBase import ErrorBase


class TestClass:
	"""
 	"""
	def __init__(self):
 		"""
   		"""
	 	# private
	 	self.error	= ErrorBase()

   	def divideByZero(self, inputData: int) -> float:
   		"""
	 	"""
   		self.error.setFalse()

   		try:
	 		return inputData / 0
	
		except ZeroDivisionError as e:
			self.error.setTrue(code= 2, message= str(e))
			return -1
		
		except Exception as e:
  			self.error.setTrue(code= 1, message= str(e))
  			return -1


# render code
test	= TestClass()
result	= test.divideByZero(22)

if test.error.isTrue():
	print(f'Show the error message error: {test.error.getMessage()}')

# if there is a complex structure, let try by this way
if test.findCode(2):
	print(f'Show the error message error: {test.error.getMessage()}')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SmileError-1.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

SmileError-1.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file SmileError-1.0.1.tar.gz.

File metadata

  • Download URL: SmileError-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for SmileError-1.0.1.tar.gz
Algorithm Hash digest
SHA256 24cbd3659706d584021ba62d7f62ea47e81acd27bf654942324207ecde8c6ffa
MD5 81fd32bd6242a55dc5616fcd31307318
BLAKE2b-256 bb17e48ca19c2b3118cb29a4103c118123d9ce9dcbd2c44b7b2eedb1e911ecef

See more details on using hashes here.

File details

Details for the file SmileError-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: SmileError-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for SmileError-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a80317b380f760fecb4658eb9106d767fce93fd2da6909e04330f6b65d14f69f
MD5 6194f552050ee2dbb827059cfacd6fca
BLAKE2b-256 6e2529351f766412d7a91de534358aaee178cefff2fcf17878ffff6cf2782965

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page