Skip to main content

library for handle custom exception and commons functionalities for W&J micro services

Project description

wj_common library

Exeption library for backend in Whale and Jaguar

Description

Esta libreria tiene como objetivo brindar al desarrollador un método para responder desde el backend cuando ocurra un error, de acuerdo al estándar propuesto en W&J.

Por otro lado se han dispuesto funcionalidades que son utiles en los diferentes micro servicios desarrollados en W&J. Esto con el fin de centralizar las funciones comunes y evitar la duplicación de código.

Getting started

Requirements

  • Docker
  • GNU make
  • Git

Actualmente se ha construido la librería en el repositorio para paquetes de prueba python TestPyPI por lo que se puede instalar este paquet vía pip.

Install

pip3 install -i https://test.pypi.org/simple/ wj-common

Usage

La librería cuenta con dos paquetes:

  • wj_common: Aquí se encuentran las funcionalidades útiles que se pueden emplear para el desarrollo de nuevas funcionalides en los servicios ofrecidos.

  • wj_exception: Aquí se encuentran las excepciones personalizadas para el manejo de los errores de acuerdo al estándar.

Para obtener las respuestas de acuaerdo a lo planteado se deben usar ambos paquetes como se muestra en el siguiente ejemplo.

from wj_exception.exception.no_data import ItemNotFound
from wj_common.utils import utils

try:
    raise ItemNotFound()
except Exception as e:
    exception_resp = utils.get_response_error(exception=e)
    status = e.status

print(f"response error = {exception_resp}\nstatus = {status}")

Respuesta obtenida:

response error = {'error': {'code': 'itemNotFound', 'message': 'data not found','location': '<stdin> in line 2'}}
status = 404

License

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007

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

wj_utilities-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

wj_utilities-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file wj_utilities-0.1.0.tar.gz.

File metadata

  • Download URL: wj_utilities-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for wj_utilities-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31a741b477d31e40d536fdfd0f57622c05cfc8e814274526251619e1b95c9407
MD5 375c5c795be7775a7617f16bdfbd0dd8
BLAKE2b-256 1c9d70d4baea3637a555a944d9212df73ae45c67d059b502859dc6e439894ff8

See more details on using hashes here.

File details

Details for the file wj_utilities-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wj_utilities-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for wj_utilities-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c480625a53d286ca896075ab4ae7992e73337ccc07b0465dc65c15aa25a5304
MD5 545a5a2b1e9f8e1ea6484743a8734b48
BLAKE2b-256 f0517e4926bedd1e215560352282dc42d6e76ee341fdd0cde8fcc5451713409a

See more details on using hashes here.

Supported by

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