Open Source Fun #4 – empathetic errors

hi you’re watching open source fun which
is a stream that I like to do often to show you what the experience is like
maintaining open source hardware libraries so we do a little bit of live
coding but i also just show a little bit of github stuff as well and should be
really fun so thanks for joining me so the last few episodes of been dealing
with a library called AVRGirl -Arduino. AVRGirl0Arduino is one of my
most popular hardware libraries and I wanted to give it some love this
summer because i haven’t been able to add extra features or fix bugs as
often as I’d like to today we’re actually going to be talking
about errors in AVRGirl-Arduino but if you’re not familiar with what AVRGirl-Arduino does I could definitely tell you about that
too so let’s look at how we can perhaps improve our errors that have
been reported out of AVRGirl-Arduino when things don’t always go as we
expect so let’s get started so i have here my github page for the
AVRGirl-Arduino library so if you’re not sure of what that does
exactly AVRGirl-Arduino allows you to upload code to a long list of
supported arduino boards so a lot of the time when you’re writing
for arduino your writing the library in c and then you need a way to be able to
move and upload that compiled code onto the arduino itself so i have an arduino
here today that’s an example of one that’s an arduino micro so I wanted to write a javascript library in order to upload the code and the reason for that
is we have a very vibrant nodebots or nodeJS robots scene in the JavaScript
community yesterday was actually International
Nodebots Day where there was some really cool workshops all around the
world on how to use JavaScript to interact with robots and electronics so
it made sense to write a tool in javascript in order to upload some
precompiled code onto Arduinos because a lot of the time that’s the
first step when it comes to using javascript to interact with an arduino that’s plugged in so this library has been used in lots of
different ways it’s not just nodebots it’s been used to update firmware on 3d
printers it’s being used to update firmware over
the air on autonomous sailboats which is really awesome as well so I like to make
sure that I’m continually improving this library so today we’re focusing on errors and if
we look at this code example here after you flashed your hex file which is the
format that you have your compiled code into flash the arduino and you pass in a
callback which will give you an error if anything bad happened and it’s those
areas that were focusing on today because at the at the moment they’re not
overly useful for debugging and things like that and I’ll explain why as we go
along so I have an issue and it’s the only
issue currently open in AVRGirl-Arduino right now and this is sort of what this is
sort of the kind of thing that comes up AVRGirl-Arduino usually somebody
has trouble flashing something and this person’s been super helpful to have put
some logs in there so i can actually see what’s going on and it looks like there
was an uncaught exception and it looks like it was not in my library but it’s
kind of cool to have a look at that so we went back and forth for a while
and we figured out that it wasn’t necessarily AVRGirl-Arduino that was
causing the issues but I didn’t close this issue and that’s because they had a
request at the end they said they were basically asking if errors could be may
be handled in a better way or more helpful way and I didn’t want to forget
about that so I I kept this issue open just so i can also keep an eye on it
this person might have updates as well so i might go into perhaps what the
issues with the errors are currently and talk about how we can make that easier
for people so i’m going to go into my code and we’ll have a look at that so I’m in my main AVRGirl arduino javascript file and the reason
why I’m in here is because there are some errors in here that we can find
really easily so we can talk about what the issue is so there’s a bit at the beginning when
you’re flashing to the board where before I actually start I’m checking a few things that have been
passed in by the user of this library just to make sure that we’re ready to go there’s no point in trying to flash
something if you already know in advance that there’s a missing information or
the information is slightly incorrect so I have a method called validate board
and I just check for a bunch of things to be present one of them is to make sure that the
board that somebody has asked to flash for example such as the arduino micro or
the arduino uno we want to make sure that the the board
name they specified does actually exist in this library in order to be flashed and this is this is where we return the
call back if it didn’t find that board and we have a helpful string and we tell
them what board they actually flash that kind of thing we also have one for the protocol as well
so if if this is more on the contributor side if somebody wants to add a new
arduino to AVRGirl-Arduino but it doesn’t support that protocol yet it
will warn them about that so that helps them when they’re
developing there’s another weird case where if you have an arduino pro mini
plugged in you have to specify the USB port that is
plugged into and that’s because it doesn’t have its own serial connection
you have to use a it’s an ftdi like to USB serial converter and you’re going to
get the product ID of the converter and not of the board so we can’t
automatically find that for the users so they have to specify the port that the
pro mini is plugged into through that converter in every other case we can
actually automatically find the port of the arduino but we want to be helpful
and immediately pass back an error saying “hey, can you give us the port” so I feel like all
of these errors to a degree are helpful because usually this gets console locked
out if you’re using the CLI it will be printed out in the console but there’s a
bit of a limitation with it right so what if you know these are just three
errors there are a lot of different error types that happen in this library so
things like if the board resets and it doesn’t reappear in the port list to
connect to we throw an error if it appears in the
port but we haven’t been able to open the connection to it again we show an error and we just have errors
all over the place and when you use just a default error in JavaScript usually one
of the only useful properties are getting out of it is the actual error message itself so if we look in this
error here this is the error message that’s put out now you can see that this
error message changes depending on the board it’s also just a long string and what if
I decided to rewrite that string at a later point you might be able to see
where I’m going here this comparing the error message to find
out exactly what went wrong and where it went wrong in the flashing chain for
people using this library that’s not particularly helpful it’s not robust and
it’s very fragile so if they want to write their own errors rather than using mine if they have very
specific human language that they want to use around their particular device
that you’re flashing which is a common thing you know if it’s a 3d printer we
don’t want to refer to it as a board just things like that at the moment it’s
really hard for them to be able to reliably tell at which point did the
error happen so we definitely want to introduce something new to our era
object in order to do that today the other side of it is something you may
not have thought of immediately is that all of these areas are in English so
what if there was a non-english-speaking userbase using a library using AVRGirl-Arduino or perhaps there’s someone who doesn’t speak super
great English but they can program with English and they’re using AVRGirl-Arduino
it’s not particularly like internationalized either and it’s
very hard for somebody right now to also do that because like we said in the past
example is difficult to know which custom error message to write depending
on the error that comes back so I’d like to use an identifier like a
and identifier that won’t change that’s constant for each error type today
and then document that in the readme file for AVRGirl-Arduinol itself so
that people are aware that those error types and error code that they can
compare to exist and how to use them so that’s what we’re
going to be doing today all right so these are the kind of
errors that i want to change and then littered throughout the entire library
so what I did in advance is this week I actually looked at all of the errors i
collected them into one location and i also decided to rewrite some of them so
that they are a bit more consistent they’re a bit more clear I may continue to keep rewriting them
this week I just want to look at them but being able to rewrite them when
people aren’t necessarily relying on them on the actual message itself will
be much less dramatic now that we’re going to be using like a
more constant code so I’m going to bring up the the ones
that I found and also wanted to show you very quickly a big inspiration for this
came from the Elm language. Elm is a an abstraction on top of JavaScript that
allows you to write web pages and web applications in more of a functional
programming style it’s a very very cool idea and they
wrote a blog post about how working with compiler error messages sucks just working with areas in general suck
I think that my personal opinion is that we assume a lot of the time that a
developer is has a certain amount of technical knowledge and that they can
pass these really sometimes cryptic errors so I think that was the thinking
behind Elm as well but also Elm compiles its language down to JavaScript
so most of the errors that Elm is reporting are actual compiler errors
trying to tell the user of Elm that they’ve written some code that may not
be quite correct so this blog post is really awesome you
should check it out i’ll pop it in the description in the YouTube video it basically goes through how they
wanted to be as helpful as possible with examples here so you can see that they
even trying to correct the person suggest maybe the
method that they were actually using the error is printed out in a really nice
easy to read spaced out way I just really love it and I think that it’s a
very empathetic choice and i definitely am biased towards us as developers in
our community being more empathetic to other developers and also to users
obviously as well so that was a huge inspiration for me and I would like to
see if we can come up with something that is a bit more fitting for AVRGirl-Arduino because it is a slightly different context and where those errors
will be displaying so I thought that was really cool to find so i made a json
object here of all of the errors that we have so we have our unsupported board
error our answer for the protocol error our pro mini port error so there are three
we just looked at and then there are a few others here i’m not sure that i found the more but
this is a really good start for us and this is very difficult to read in this
note taking up that i’m using so i’m going to go into my code editor and
we’re going to start a new file and start to try and create maybe an
extension to the JavaScript object itself so that we can still use
JavaScript objects but we can perhaps provide some additional custom
information in there so if I paste that in here now and I say
that as I can save that as error.js and going to
save that in my library directory so this is just keeping it in the AVRGirl-Arduino library you might be able to read it slightly
better now ok so this is a json object each this is the error code that I’ve
come up with so having this standard error code that
will never change because we’re very familiar with what kinda errors we have
an AVRGirl-Arduino this is what we’re going to allow the users of our library to
compare against so they can check the type of error by looking at this string
code here and the string codes is still descriptive even in short form so it
should be pretty easy for somebody using AVRGirl-Arduino to understand and
to be able to parse and use these new error codes and then the error messages
themselves I’ve turned these into interpolated
strings now interpolated strings are going to cause us some trouble down the
track but today is just supposed to be a first pass on how we can make these
areas better and i’ll describe the issues we may have with interpolated
strings later on if you aren’t already sort of seeing that ahead of time so i
replaced all of the customised information that we saw such as the
board type or the protocol with a tag called custom and that will allow us
to compile or interpolate that string at runtime so that we can put that pop
that extra information in what you’ll see though is that these always these
codes always remain completely static so that’s a good thing so I’ve written them to be a little bit
more consistent these here are errors that I’m bubbling straight up from the modules that deal with the protocols
so their dependency of AVRGirl-Arduino but they’re not necessarily from
AVRGirl-Arduino itself so if there’s any errors there then I
just want to bubble them straight up and I’ve given them the generic assignment
of STK500 version 1 error and so on and so on usually at this point if you’re finding
these errors they’re coming up from the point where you’re pretty much
almost about to flash or your rereading the program back from the board to make
sure that the content that you were trying to flash matches so it tends to
be a lot further along the line and they’re very rare as well but if I have
these hard coded here whenever someone opens an issue on Github that’s going to help me ask them like
what was the code and that will mean that I’ll be able to debug stuff a lot
quicker and it’ll just be a happier situation for everybody so that’s why i put these ones in today
we may not actually get time for them but we’ll see so this is what I want to start with but
let’s look at the JavaScript object itself so mdn is one of my favorite
resources for JavaScript so if you haven’t used it before I you should
definitely check it out its developer . there is a JavaScript
section there’s obviously a HTML and CSS one is well given that they’re also
language is used in the browser but we’re in the JavaScript one today and
this is under the standard built-in objects so here’s our error and it it lets us know how to invoke that error and all of these are actually
optional arguments and the only argument i’m using right now is message and you
can output the entire error object which is what I’m doing in AVRGirl in my code
examples but you can also just output the message by going to console.log(error.
message) so these are where the parameters are
that you can output it seems like the only browser
consistent property that you can get out of these message and also
potentially stack the others tend to be slightly different or they sometimes report the wrong line
number or they’re just specific browsers only so it’s sort of interesting there are also a bunch of error types as
well i was tempted to do some error types rather than error codes today so
instead of having a syntax error for example I might have a reset error as a
type but I sort of wanted to explore just codes for now to see if they useful
but I definitely think that error types might be a cool thing to be able to
create some custom stuff with so there’s also a which actually
refers to the type error as well and you can see here that these are very browser
specific properties on the error which we also want to ignore because we can’t
necessarily trust that either but i found a code sample further down where
we can create custom error types now we don’t want to create a custom
error type today but we do want to extend the JavaScript object in order to have
more helpful properties people can access I realize that I’m being a bit of a
browser vendor here by giving custom properties but I think honestly in my
case it’s going to help a lot and this library is run in both the, um – it’s a compatible in chrome apps but
it’s mostly used in the nodeJS runtime so that’s usually a bit more custom then
browsers anyway so there’s a good example here on just
from line 1-8 on being able to create your own custom error and you are
essentially extending the current Error prototype and then you are adding some
extra things in and then you’re also potentially shadowing some of the
properties in the prototype chain too with your own so we’re not going to use all this today
but this is a really good example to start with so i’m going to copy from
line two through to 8 that’s all we really need and
we’ll probably delete a couple of things too so we’ll leave this up here for now
it’s not particularly syntactically correct but we will leave this for now
and we’re going to create our error now I want this to be an imported, sorry
a required node module so instead of function myError actually going to
create like module. — wow good typing toda, Suz, i slept
really well so module exports=function and we probably don’t want the
message either and I think what we want to do is pass
in some options and you’ll see why later on I was sort of thinking about this well I was getting ready for bed last
night so I have a few ideas ajead of time I don’t necessarily want to change the
name because this changes the type of error I’m okay with it just being a generic
error type because then people can still check to see if it’s an instance of
error or something like that I feel like that’s less likely to break
things for people existing. The message we generally don’t
use a default message and we don’t have to really guard against that as much so
I will get rid of the default message that could end up probably less helpful
and most of this example here where it says
this.stack and then we’re creating a new error and then we’re getting the stack
out of it the reason why we do this is if you
change the type of error or the name to like a different areas such as myReallyCoolErrorType, the stack when you create this error will be wrong it will still
have just the generic error as the type in the stack so if you want your new
your fancy new error type to show up properly in the stack in the first line
you just create a brand new stack from scratch and then that will help tie it
to the type properly in that kind of thing so we don’t need that either so we definitely want to be setting the
message and we will be passing that in and i’m not sure why this is set to four
spaces I do definitely prefer two (laughs) okay cool this is this is on a weird
indentation too so we can keep the message for now we’re
probably going to be getting that from this object here so i might actually do
that too so at the moment it makes sense to put
these errors into our error object from the beginning later on it would make
sense to abstract this out so we can store these in a different file so that
we can use them at different places and we can have enums and stuff like that
which I would really like to do for my the users of my library but for now
especially since we sort of scrappy throwing us together to see whether or
not it it sort of works i’m going to create a variable called errors and then
we’re just going to assign this object here to be the errors themselves so now we have access to them and we can
interpolate them in real time and no reason why we need to do this is because
we don’t know exactly what the nature of some of the errors will be sometimes it
will be with an arduino uno sometimes it will be someone trying to use the AVR110 protocol which is not supported so we we need to be able to do this
every time this this custom error is created because we
wanted to be as accurate as possible so again abstraction later on will be a
good thing but at the moment because we’re using string interpolation it is
very difficult to do that the es2015 string and interpolations are just supposed to be done in real time
and they’re not necessarily meant to be templates you have to do some complex
functions and methods and things to do that and I don’t want to get tied up
with doing that today so hopefully that explain why we’re putting this in here
locally it is still in ok location because we’re keeping the concerns all
together these are the kinds of errors that we
can throw for AVRGirl-Arduino itself now if we’re string interpolating and
we’re going to be replacing this with custom content we probably want to pass
that custom content into this particular error function when we instantiate a new
one right so i’m going to assume that that’s going
to be part of the options that we pass in and you’ll see the implementation of
this later on and it will make a little bit more sense so I’m going to say var custom=
and we might make this just a blank string if they haven’t specified it
because you can see here that this particular error doesn’t need any fancy
custom keywords or anything so I’m just going to say its options are custom or
if that’s not defined then we want it as an empty string and
that will be quite harmless really it will mean that even if we
accidentally don’t pass in our custom keywords in here it will just chop that off and it will just say “is not a supported board type” so I tried to write these here so that it’s
still sort of made sense if something went wrong in the interpolation didn’t
happen so hopefully that helps ok so now that we’ve created our custom
as it works down here in the javascript it’s going to do it’s going to compile all
the strings for us so they will be ready to go and then we just need to pick out
the correct one right to use as our message so i thought a good idea was to
when you’re creating a brand new version of this custom error that you could
specify the code of the error in options and just to reiterate this here
is the code that sort of would have called it because another
inspiration that I took was from the stripe API so the stripe API is a
payment gateway API and the stripe service is really awesome it allows you
to securely take payment methods that includes bank
accounts and credit cards online so if you want to have a checkout they make it super super easy to get up
and running so their nodeJS api docs really really awesome and i
noticed recently because my day job I’m a front-end developer and I have had to
work with the stripe API in my current job for i was looking at the kind of
errors that can come back because we was trying to solve a rather confusing issue
and i notice here that there are some error types that come back in the
response json from the API requests and I really just liked this format i felt
like it was easy to read we’re not doing things like error codes
like numbers which can be hard to sort of map and reference, especially when i’m
debugging my own library I just loved these so much and then they
have error on the end as well so I’ve definitely ripped off this pattern
that’s sort of what I was thinking when I was coming up with these this week so
we’ll go back to the code so that you sort of understand where that came from so we want to set the message so right
now message isn’t actually defined in this function because we took it from
the other example so we want to be able to fetch out the correct
error so we’ll create a new shorthand variable for that called code and that’s
just going to be options.code and we’re going to make that required so we
weren’t necessarily fall back to something default and in order to set the message
of the of the the error we have to fish out the correct one right so our object is
errors and our the location of the key that we want to pull out is the code
itself so i feel like that would work so what have we done now? We’ve basically
created a custom error but we haven’t improved it in anyway so essentially
this is just creating the exact same error that we already have which is using
these fancy string interpolations and like an error object abstraction so
this is where we have the power to add extra things and so what I want to
actually add is a brand new property called code so if someone gets an error back in AVRGirl-Arduino we know they can access that by just doing if error then console.log(error.code) and then that’s
a way more robust way for them and then they can write their own custom error
messages as I explained before so i think that would be kind of cool so it should be as simple as creating a
brand new property on and i’m going to make its this.code=so I guess
code? yeah that may be cool and I feel like
that’s probably okay it may actually make more sense to put
on the prototype later on but I think for now this is probably ok so I feel like that’s probably a good time
for us to sort of start testing it out a really easy way of testing that out is
to run AVRGirl-Arduino without an actual board plugged in because we get an error
immediately that it couldn’t find the board right and i can demonstrate that
on the command line for example if i say AVRGirl-Arduino flash and i’m specifying
the board as the arduino board as an uno and then i’m giving it a file.. at the
moment I have none of the stuff plugged in in fact all of my USB ports are now
taken up they’re completely overloaded so we won’t get to test with a with an
arduino today but we don’t necessarily need to we’re trying to make sure that
errors are happening so anyway if i click – if i press enter
now you’ll see error: no arduino uno found now that’s not testing our code this is
just the current existing latest version of the CLI installed on my computer but
you can see here that we can easily get an error by like doing with almost no
effort so we’re going to use that error today so
let’s try and implement this actually you know what we could probably
implement the other error where the board is an unsupported board so what if i try and just make it the unoooo which is
not a supported board I’m not even sure if that board exists in real life so
let’s have a look at that ok so we have a new error this time
which is “oops that board is not supported sorry” so that’s actually the the command line
error it’s slightly different from the one that we’re using but that’s an example
of how we can do that if you want to see the one that we return programmatically, um – I view errors in a CLI version of
something and the errors in an app is sort of different concerns so that’s why i have slightly different
error messages and maybe I want to make them consistent later on but i feel that
that was the choice that I made so it may be worth revisiting but not to get
too off the track if we do tests and then I have some
demos and I can go to the uno one what if we altered that to be the wrong
board type so if i go into this is sort of setting up our way to test these
errors in case you’re not following along so this file that i’m about to run with
the node one time here is this file here we’re creating a new instance of AVRGirl so this is sort of where we want to change that to unoooo (laughs) and then this file should immediately
throw an error so let’s have a look at that great so this is the particular string that
currently exists and this is the error object here so as you can see this error object just
contains the message only and you’ll see that that will be extended later on to
have access to other things cool so let’s go and swap out the
error now that we have this incorrect file to test with so the error that we wanted to swap out
is this one here which is the unsupported board type error so the first thing we need to do is
import this file right because we we created it we saved its error.js in ./lib so we
want to import this into this file here so i will copy this and it should be in
lib and error yes, man, I should really look at file names and
we’re going to call this like an avrgirl error because that’s like a special
like snowflake error object that we can use throughout this entire library we’re
going to sprinkle some some custom error magic so i’m going to call it a avrgError and
then that will hopefully make sense to anyone is coming along and there it wanting to add to this library and
the sort of like me this is not standard error what’s going
on so this should hopefully help them as well so instead of a new error we want to do a
new avrgError right so that’s the only substitution we have to make there and
we don’t need the message anymore because that message is totally taken
care of for us so we want to tell it what type of message it is and if we look at the errors here
sorry the error function it takes an options object we’re
assuming that’s going to have any custom keywords we want to put in but at the
bare minimum it should have the code so this is an error that we need to have
both for so we need to pass in the type of board where it says you know, “unoooo
is not a supported board type” we definitely want to do that so we will be
doing the the two different options right now so the most important thing is the code
right so let’s look at what our new fancy code is I believe that should be
the unsupported board error so we’re going to copy that immediately
and then we’re gonna go back and I’m going to say that’s what my code
is and the custom that we want to put in is the board the actual board that was
passed in from the options of the AVRGirl instantiation itself so if I unless i’m remembering wrong
because it is delete that code I probably should have just copied on a
new line for reference but i think that should be just this.options.board
so we pass that in and then that will go all the way through and be
probably interpolated and compiled in this string literal which is awesome so unless I did something super silly we may be able to test this right now I
feel like all the parentheses and the curly braces and everything are all in
the right spot so let’s try running that again ahhh, “myError is not defined” good point so I need to name this function and its
complaining because we’re actually extending the function later on by using like prototypical inheritance from the original of error
object in JavaScript its prototype so i need to name this so this will be a avrgError and we can
copy and paste that everywhere we see myError so that was definitely something that I
overlooked so we still want to keep this this.Error.prototype but we definitely
want to swap this over too. I feel like that’s probably okay so let’s give that another go.
something else went wrong avrgError.prototype avrgError is not defined, interesting so we might do is leave this here is function avrgError and then maybe we’ll do module exports . avrg era and then that object
is all kind of being completed that was a really weird error i’m not
sure why that happened definitely hit me up and chop it in chat if you see
something we had that I’m overlooking all right I alright so we got it so I’m going to
clear that no it’s not just you can see that a little bit so we still have you
knew is not a supported board type but now we have like the message which the
reason for that is I didn’t end up assigning that to the prototype and we
also have a code so that’s pretty cool and I feel like we
can just kind of leave that as it is right now and sort of start exploring
that so that worked out pretty well so in here we are definitely going to
get the error coming back up through and we’re actually console logging out here
so that’s how it ended up in our terminal so what would happen if I tried to
console log the error.code only what would happen then this is exactly what
we want people to be able to access so let’s make sure that works excellent so now they have something that is a
little bit more robust and that they can write their own stuff alright so what if I what if i start
checking what type of error it is and what if I say if error.code is equal
to and then i can copy my unsupported board error and this is where having maybe
namespace errors such as AVRGirl-Arduino .unsupportedboard or something
would be great because you still have to kind of deal with these strings but for
now this is pretty good so that should work so now we can have like we can
actually final people through different workflows depending on whatever it was
like this is really exciting so I can do something like console.log “I got to write a custom error message, yay!” so that’s pretty cool so let’s let’s see if that works I don’t
get rid of this call so that’s something that’s a direct
example that on how we can route people through and if we got an unsupported
board error for example maybe someone who is writing the library might want to
have a look to see if it’s really really similar to like for example who knew maybe there’s like two hours or someone
felt it with to use or two ends or something or you know something with
like that you could be really helpful and suggest maybe that they meant export
or things like that I don’t know this kind of makes it a bit
easier for people to go and have a look at what someone actually specified so
that’s also an advantage that i can do i can now start doing order correct in
that sort of thing in my own library so that’s pretty cool so that’s just a really quick example of
how we can make errors way way better and I feel like there’s probably a
little bit more work to do but this is a first pots so the next thing i want to
do is to go through and start sort of replacing these so to you know to do
this kind of stuff so we can definitely do a couple more and then test that out
and then I’m probably going to finish up for the day so well at least for this
stream so i’m going to create going to just rip this off here and I’m going to
put it in here so this time our custom keyword is this.board.protocol so I’m
going to try and memorise that (laughs) ok so this. .. oh my god I forgot already this.board.protocol, ok protocol ok and instead of unsupported board I
think it’s like unsupported protocol error so let’s put that in this is sort
of how nice this is now I’m like really pleased with this it makes it a little
bit more obvious what’s going on those confusing kind of string concatenations can go away as well which is really nice and then this one is just static so this
is also why i wanted to do an example of one of these two just you can see what
that looks like so this is just a static error it
doesn’t have it doesn’t have anything custom in it so we can also test to make
sure that it doesn’t blow up if you don’t have the custom keyword pass into
your options so we can get rid of this entirely and we can call that like I
think it was like the pro mini port error okay seems I’m giving them logical names
because I can sort of recap them off the top of my head ok so that just takes like one key in
the options argument and that should be ok – so I want to test this one in order
to see whether or not that comes back with this one is probably fine so I have a demo file for the pro mini
and I kind of gave it like a fake port, so I’m going to just delete that part out so this is doing the wrong things so it
will should immediately blow up if I do node tests/demos/ pro mini let’s see there we go okay so
there are using a permit me please specify a port in your options and then the
code is pro mini port error so that’s pretty good too that
didn’t blow up so that sort of tells me that this might be a nice pattern to use
so i definitely want to further explore this but I wanted to show you examples
of how you can just do a little bit of extra work in order to make the
development experience with people using your open source software a little
better hardware is very, it’s very nuanced you
don’t usually have just one error such as like an API response that comes back
so it does pay to just be a little bit more aware and put a little bit more
effort into helping people understand exactly what’s going on I think just flashing the micro alone you could probably run into four
different or even five different errors along the way and so when you’re dealing
with that many you definitely want to provide a really nice experience like
this so i’m going to continue to explore this and I’m going to maybe look into
using namespace errors and things like that so that it’s a nicer user experience
once I figure that out the next step would be to read release some
documentation in my readme file on how to interpret those errors what those errors are exactly what they
mean and how to use them in your library so that you can provide a better
experience for your users so I think that’s all I’m going to do for today and
so thank you so much for joining me I do these quite regularly i usually
tweet or Facebook or something like that before i’m going to do the stream they’re generally on weekends on either
saturdays or sundays usually around lunchtime eastern USA time which is
where i live i live in New York so I wanted to thank you again for tuning in and i will see you next time

4 thoughts on “Open Source Fun #4 – empathetic errors

  1. Excellent channel. I am going to be working on a robotics program with the media director at my sons school. Will definitely be looking into Arduino

Leave a Reply

Your email address will not be published. Required fields are marked *