meparser

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

MongoDB error Parser (MEPARSER)

Go Reference

This module is a free software and their objective is to facilitate the MongoDB error compression, transforming it in a JSON convertibles object readable by humans.

This package has a strong code documentations that generates the fullfil tutorial disponible at go.dev reference page, that is enough for their usage.

Read the full documentation at: https://pkg.go.dev/github.com/gsdenys/meparser

Software Quality

Quality Gate Status Maintainability Rating Security Rating Coverage Vulnerabilities

This lib use Sonarcloud combined with Horusec to understand the code quality and security, blocking the pull request in any vulnerability incidence.

As well as security, performance is a fundamental factor of all software, package or modules. This way, this package use the benchmark regression to ensure that no performance gaps ocours.

The result of benchmark regression is disponible at: Performance Regeression

License

Copyright 2022 gsdenys

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

The meparser package provide a way to parse the Mongo response errors. Their usage is really simple and consiste just in invocate the function Parse passing as parameter the error received by the mongodb operation. For more information see the Parse documentation bellow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(err error) []error

Execute the mongo error parser. This function receives as parameter the error received by the mongodb operation and returns a formatted error array that can printed as JSON String.

Note that to facilitate the usage, the status of the returned errors is mapped as a HTTP status.

By now, this just parse the error 121 -> DocumentValidationFailure and the 11000 -> DuplicateKey. All other will returns a generic internal server error message with status 500.

Types

This section is empty.

Jump to

Keyboard shortcuts

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