swift
directplayerror.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include "directplayerror.h"
5 
6 #include "misc/logmessage.h"
7 
8 namespace swift::simplugin::fs9
9 {
10  HRESULT logDirectPlayError(HRESULT error)
11  {
12  QString errorMessage;
13  switch (error)
14  {
15  case DPNERR_BUFFERTOOSMALL:
16  errorMessage = "The supplied buffer is not large enough to contain the requested data.";
17  break;
18  case DPNERR_DOESNOTEXIST: errorMessage = "Requested element is not part of the address."; break;
19  case DPNERR_INVALIDFLAGS: errorMessage = "The flags passed to this method are invalid."; break;
20  case DPNERR_INVALIDPARAM:
21  errorMessage = "One or more of the parameters passed to the method are invalid.";
22  break;
23  case DPNERR_INVALIDPOINTER: errorMessage = "Pointer specified as a parameter is invalid."; break;
24  case DPNERR_INVALIDURL: errorMessage = "Specified string is not a valid DirectPlayURL."; break;
25  case DPNERR_NOTALLOWED: errorMessage = "This function is not allowed on this object."; break;
26  case DPNERR_INVALIDOBJECT: errorMessage = "The Microsoft DirectPlay object pointer is invalid."; break;
27  case DPNERR_UNINITIALIZED: errorMessage = "This function is not allowed on this object."; break;
28  case DPNERR_UNSUPPORTED:
29  errorMessage =
30  "The function or feature is not available in this implementation or on this service provider.";
31  break;
32  case DPNERR_NOTHOST:
33  errorMessage = "The client attempted to connect to a nonhost computer. Additionally, this error value may "
34  "be returned by a nonhost that tried to set the application description.";
35  break;
36  default: errorMessage = QString("Unknown error code %1").arg(error); break;
37  }
38 
39  errorMessage = "DirectPlay: " + errorMessage;
40  swift::misc::CLogMessage("swift.fs9.freefunctions").error(errorMessage);
41  return error;
42  }
43 } // namespace swift::simplugin::fs9
Class for emitting a log message.
Definition: logmessage.h:27
Derived & error(const char16_t(&format)[N])
Set the severity to error, providing a format string.