Merge pull request #26386 from ksooo/guiinfo-fix-listitem-filenamenoextension
[xbmc.git] / xbmc / interfaces / legacy / Exception.h
blob61a32be2db7dcbd1146c308d9fd6be6519997990
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "commons/Exception.h"
12 #include "utils/log.h"
14 #ifndef SWIG
15 namespace XBMCAddon
17 XBMCCOMMONS_STANDARD_EXCEPTION(WrongTypeException);
19 /**
20 * UnimplementedException Can be used in places like the
21 * Control hierarchy where the
22 * requirements of dynamic language usage force us to add
23 * unimplemented methods to a class hierarchy. See the
24 * detailed explanation on the class Control for more.
26 class UnimplementedException : public XbmcCommons::Exception
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); }
35 /**
36 * This is what callback exceptions from the scripting language
37 * are translated to.
39 class UnhandledException : public XbmcCommons::Exception
41 public:
42 inline UnhandledException(const UnhandledException& other) = default;
43 inline UnhandledException(const char* _message,...) : Exception("UnhandledException") { XBMCCOMMONS_COPYVARARGS(_message); }
46 #endif
48 /**
49 * These macros allow the easy declaration (and definition) of parent
50 * class virtual methods that are not implemented until the child class.
51 * This is to support the idosyncracies of dynamically typed scripting
52 * languages. See the comment in AddonControl.h for more details.
54 #define THROW_UNIMP(classname) throw UnimplementedException(classname, __FUNCTION__)