xbmc
Exception.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "commons/Exception.h"
12 #include "utils/log.h"
13 
14 #ifndef SWIG
15 namespace XBMCAddon
16 {
17  XBMCCOMMONS_STANDARD_EXCEPTION(WrongTypeException);
18 
27  {
28  public:
29  inline UnimplementedException(const UnimplementedException& other) = default;
30  inline UnimplementedException(const char* classname, const char* methodname) :
31  Exception("UnimplementedException")
32  { SetMessage("Unimplemented method: %s::%s(...)", classname, methodname); }
33  };
34 
40  {
41  public:
42  inline UnhandledException(const UnhandledException& other) = default;
43  inline UnhandledException(const char* _message,...) : Exception("UnhandledException") { XBMCCOMMONS_COPYVARARGS(_message); }
44  };
45 }
46 #endif
47 
54 #define THROW_UNIMP(classname) throw UnimplementedException(classname, __FUNCTION__)
55 
This is what callback exceptions from the scripting language are translated to.
Definition: Exception.h:39
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
UnimplementedException Can be used in places like the Control hierarchy where the requirements of dyn...
Definition: Exception.h:26
void SetMessage(const char *fmt,...) XBMCCOMMONS_ATTRIB_EXCEPTION_FORMAT
This message can be called from the constructor of subclasses.
Definition: Exception.h:70
This class a superclass for exceptions that want to utilize some utility functionality including auto...
Definition: Exception.h:44