Debugging Bitcoin Script failures

When developing application which creates and broadcasts bitcoin transactions, it is very likely you will need to deal with Script errors.