I failed my grade 8 piano so I'm speaking from experience here. I know how gutted you must be but you have to look at it in a positive way ( i know you probably won't feel like it now - but you will do)
Take the time to read what the examiner wrote. I screwed mine up and ended up fishing it out the bin a while later when I'd calmed down a bit. Generally exminers give quite constructive comments. Discuss these with your teacher and work out a plan of action (sounds sad i know!)
Don't look at it as a failure. Yes ok, you did fail but it's a fact of life and it means you won't get complacent and take things for granted. It made me so much more determined and I put in more more hard work and practice - I was determined to pass it with a good mark. It made me stronger and much better player (and I hope teacher) beacause I knwo that i will Be able to help a pupil if they were ever to fail (I have a 100% success rate so far with my pupils but I know the day will come when someone will fail).
Failure is a terrible word. They say when you fall off a horse to get back on straight away. Do the same here. Take the examiners comments on boars and go fo rit again.
Believe in yourself - you can