Reporting Errors

An NP returns standard error codes to report errors like insufficient memory. An NP can also use the error reporting services NPSSetCustomText or NPSSetExtendedError described below to report errors that contain provider specific information. An NP should not call SetLastError.

Also, because MPR can try several networks when attempting a network operation, NPs need to be very careful to not return a hard error code unless certain that the request is specifically for their network. This can cause MPR to terminate trying networks and report the error back to the user. When not certain that the error is for its network, an NP should return only one of the following errors (since any other error returned will cause MPR to stop trying other networks to satisfy the request):

Note that, in particular, returning ERROR_BAD_NETPATH will cause MPR to stop trying other NPs, so this code could be returned, for example for a bad share name when the server name is known to exist. Used in conjunction with NPSSetCustomText this gives good performance, a descriptive error to the user, and the calling program good opportunity for intelligent error handling.