In firefox, it throws up a generated error in response to the website that im creating (which is my work). can i then copy and paste part of that error into my program as part of a solution im writing?
You probably can. There are a few questions here.
First, is the message protected by copyright? In general, it probably is, but there are many exceptions that might allow you to use it without permission. Unfortunately, these exceptions vary from jurisdiction to jurisdiction. The exceptions tend to allow the use of small excerpts of a work for various sorts of purposes that don't undermine the copyright holder's ability to profit.
That leads to the second question, which is why you are using that message. If you're including it in your source code so you can test whether a message generated at run time is in fact that message, that's one thing, and it's probably okay. On the other hand, if the owner of the copyright sells a database of all its message strings, and you're compiling a similar database that you also intend to sell, that's probably not okay.
A third question concerns the Firefox license terms. It's entirely possible that they allow you explicitly to do what you're considering, in which case it doesn't matter what copyright law says about it. On the other hand, Firefox is open source software, and under some open source licenses, if you incorporate any of the source code in your own product, you are required to release your product's source code under the same license. If you're not already planning to do that, you should consider carefully whether including that error message would trigger that provision (if there is one) of Firefox's open source license.