Giter VIP home page Giter VIP logo

clojure-error-message-catalog's Introduction

Clojure Error Message Catalog

a catalog of common Clojure errors and their meanings

What is it?

We are experimenting with starting a community driven catalog of common errors. The main categories will be Clojure, ClojureScript and libraries.

The idea is that people can submit an issue with a particular error, or make a pull request with the error, description and hopefuly one or two solutions to resolve it.

Eventually, the plan would be to create a site where you could paste errors and search for them that way, but it would make sense to start with a GitHub repo to see if there's interest. Hopefully, this will also help identify the most common errors people have trouble with and make error reporting better in Clojure itself.

This project was inspired by the way Elm does this, where they have a repo for this purpose, and then provide custom compiler errors for these cases.

We need your errors!

This catalog is community driven, hence your contribution to this is invaluable.

It is very simple to contribute / share errors, exceptions, causes and possible solutions. There are 3 main sections of the catalog:

1. Clojure errors

  • Live under clj
  • Here we collect all Clojure core errors: i.e. errors that are raised from/by Clojure itself.

2. ClojureScript errors

  • Live under cljs
  • Here we collect all ClojureScript core errors: i.e. errors that are raised from/by ClojureScript itself.

3. Library errors

  • Live under lib
  • Here we collect all errors that are raised from/by any Clojure / ClojureScript library (Ring, Compojure, your library, etc..)

How to submit a new error

In order to contribute, please check that the error is not already in the catalog. If it is and you need to add / change anything, just send a pull request.

Error file name

Errors are submitted as markdown files (i.e. .md). The file name would be very close to the exception.

For example, let's take an exception:

#object[mount.core.DerefableState 0x52691944 {:status :failed, :val #error {
:cause "mount.core.DerefableState cannot be cast to clojure.lang.IFn"

So something like derefablestate-cannot-be-cast-to-ifn.md would be a great, descriptive file name for this error.

Error file format

Would be really helpful to have the following in the error file:

  • Exception
  • Description of the exception
  • Common cause(s)
  • Solutions

Share a file that describes these sections in a markdown format:

## Title: Exception message
### Description: general description of the exception
### Cause 1: Cause title
### Solution 1
...
### Cause n: cause n title
### Solution n

Why the "format"?

Following this format / guideline allows this error catalog to be processed into a format that can be also readable by programs (i.e. not just us, humans). Which enables great things like [contextual search] (https://en.wikipedia.org/wiki/Contextual_searching), IDE/tooling integration for suggestions, etc.

Check out this error file to visualize the required format.

Where to place the file?

Since there are 3 main sections (clj / cljs / lib) place it under the section that matches the nature of the error.

For example the error ("mount.core.DerefableState cannot be cast to clojure.lang.IFn") would live under lib/mount/ since it is caused by the library that is called mount.

In case the error is Clojure core related, place is under clj.

ClojureScript core related errors would go under cljs.

So the steps to contribute are:

In case you have any questions, suggestions, please let us know via opening an issue or pinging us on clojurian slack (@yogthos, @tolitius).

Website

The very beginnings of a website where people can browse and search the error repo, and submit new errors, is here. Contributions to the website are also extremely welcome. It's currently planned to be a very simple static website.

License

Copyright © 2016 Clojure Community

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

clojure-error-message-catalog's People

Stargazers

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

Watchers

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

clojure-error-message-catalog's Issues

Change readme to match latest understanding

The error page submitted on 04/29 uses a somewhat different format than is recommended on the readme. It was done using this format based on conversation in slack about whether error pages should ultimately reflect a single exception, or a single cause of a single exception. The decision made on the fly was that one page equals one error. To fit that, the referenced page uses the following Markdown format for sections:

## <Text of the exception message>
### General description of exception
### Cause 1
### Solution 1
### Cause 2
### Solution 2

I propose that the readme be changed to reflect that (and I'd be happy to take that on), but wanted to get buy-in from other folks on the project first. This may not be the final decision on format, but I think it makes sense to have the readme reflect our most current understanding.

Note that this change is consistent with issue 14, but potentially conflicts with some of the formats proposed in issue 6.

Dependency conflict style errors?

I had an issue with a dependency conflict yesterday between aws and transit.

I don't want to call out those libs in particular as it's a general problem that happens all the time when you mix libs and they have different transitive dependency versions.

In this case I got a ClassNotFound error which is misleading. After a lot of head scratching I eventually tracked it down to a transitive version conflict for jackson.core. Let's just say that was not obvious - even if, like me, you do have a Java / Maven background.

The immediate fix was to add an exclusion on one of the libraries but that might break as each library version evolves.

How can I add this error / type of error to your catalog?

50 error patterns (Prior Art)

There exists a catalog of 50 error patterns documented with regex here:

  • assertion-error-with-argument
  • assertion-error-without-argument
  • class-cast-exception-cannot-cast-to-map-entry
  • class-cast-exception
  • assoc-parity-error
  • wrong-number-of-args-passed-to-a-keyword
  • illegal-argument-no-val-supplied-for-key
  • illegal-argument-vector-arg-to-map-conj
  • illegal-argument-cannot-convert-type
  • illegal-argument-even-number-of-forms
  • illegal-argument-even-number-of-forms-in-binding-vector
  • illegal-argument-needs-vector-when-binding
  • illegal-argument-type-not-supported
  • illegal-argument-parameters-must-be-in-vector
  • illegal-argument-exactly-2-forms
  • duplicate-key-hashmap
  • cant-call-nil
  • compiler-exception-wrong-number-of-arguments-to-recur
  • compiler-exception-on-improper-use-of-arg-literal
  • index-out-of-bounds-index-provided
  • string-index-out-of-bounds
  • index-out-of-bounds-index-not-provided
  • arity-exception-wrong-number-of-arguments
  • null-pointer-non-existing-object-provided
  • null-pointer-non-existing-object-not-provided
  • unsupported-operation-wrong-type-of-argument
  • compiler-exception-must-recur-from-tail-position
  • class-not-found-exception
  • number-format-exception
  • lisp-reader-exception-long-error-error
  • reader-tag-must-be-symbol
  • invalid-tolken-error
  • invalid-tolken-error
  • syntax-error-cant-specifiy-over-20-args
  • compiler-exception-first-argument-must-be-symbol
  • compiler-exception-cannot-take-value-of-macro
  • compiler-exception-cannot-resolve-symbol
  • compiler-exception-map-literal-even
  • compiler-exception-unmatched-delimiter
  • compiler-exception-too-many-arguments
  • compiler-exception-too-few-arguments
  • compiler-exception-end-of-file
  • compiler-exception-end-of-file-string
  • compiler-exception-no-such-var-with-namespace
  • compiler-exception-no-such-var-no-namespace
  • compiler-exception-no-such-namespace
  • java.lang.Exception-improper-identifier
  • compiler-exception-even-numbers-in-binding-vector
  • compiler-exception-even-number-of-forms-needed
  • compiler-exception-wrong-number-of-arguments

going in the right direction?

I think these error docs might be moving in the wrong direction:

Some errors can happen in a multitude of contexts, but the above errors attribute them to specific cases only, though they obviously can show up elsewhere. Sorry, this was just my gut reaction, and I haven't thought about it too much yet, but I thought others might be thinking the same thing, so I wanted to bring it up early.

My secondary reaction is that following in this direction could amount to us documenting error reports for every function/macro arg type. Surely there is a better plan for dealing with this class of errors?

Documentation format

At the risk of slowing down contributions, would it be worth documenting these errors in edn/cljc, and then generating documentation from them? This would allow better tooling to be built around the errors.

I guess the risk is that errors aren't improved in clojure.core upstream since it might be seen as solved by tooling, which I think is the wrong approach overall.

Create basic website for display and submission

Git isn't a big obstacle for many programmers, but we could decrease submission friction significantly further, in my opinion, by creating a website with a submission form. This would have the additional benefit of ensuring a consistent format (by separating the form into fields for error, description, cause(s), solution(s), possibly others).

Further, a basic website would be a place to display error pages in an attractive format for users who were only interested in looking for help on the error they've encountered, and provide a convenient search mechanism.

The main inspiration here is the Scala Clippy website, which has tabs for usage instructions, contribution form, and a browse page, as well as links to the project's github page and to the project's gitter chat.. Seems like a simple and effective model. There'd presumably be a cron job or equivalent to periodically update the site from the repo. My first thought for handling submissions is to write code to convert them to PRs. Alternately, the final source of truth could switch to being a persistent database, but having it be the repo seems good enough for now to me.

I'm happy to work on it, but given my current time constraints it would be a while before I had anything ready to go. If someone else wants to take it on, that's great. We'd also need to have a hosting solution of some sort.

This may not be high enough priority to tackle immediately, but I wanted to get it out there for discussion & input, and I certainly see some advantage to prioritizing creating a minimum-friction way for people to submit errors and/or solutions.

Feedback & input appreciated.

Wrong parentheses kind when creating keyword'ed map

Found this with a teaching session with a Clojure beginner:

IllegalArgumentException Wrong number of args passed to keyword: :bread

Clearly this only works when the first item in the list is a keyword (in this case :bread).

Integrate via lein-plugin/boot?

I'm a complete beginner with Clojure (mainly focused on Clojurescript) so maybe I'm thinking completely wrong. I do appreciate this initiative since error message in Clojure (coming from a non-java background) is very foreign and hard to parse.

But, would it be possible to hook into something in lein/boot when an error happen and automatically link to something in this catalog? That would make usage of this so much easier.

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.