gproc_int.hrl 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. %% ``The contents of this file are subject to the Erlang Public License,
  2. %% Version 1.1, (the "License"); you may not use this file except in
  3. %% compliance with the License. You should have received a copy of the
  4. %% Erlang Public License along with this software. If not, it can be
  5. %% retrieved via the world wide web at http://www.erlang.org/.
  6. %%
  7. %% Software distributed under the License is distributed on an "AS IS"
  8. %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  9. %% the License for the specific language governing rights and limitations
  10. %% under the License.
  11. %%
  12. %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
  13. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
  14. %% AB. All Rights Reserved.''
  15. %%
  16. %% @author Ulf Wiger <ulf.wiger@feuerlabs.com
  17. %%
  18. %% gproc_int.hrl: Shared internal definitions
  19. -define(CATCH_GPROC_ERROR(Expr, Args),
  20. try Expr
  21. catch
  22. throw:{gproc_error, GprocError} ->
  23. erlang:error(GprocError, Args)
  24. end).
  25. -define(THROW_GPROC_ERROR(E), throw({gproc_error, E})).
  26. %% Used to wrap operations that may fail, but we ignore the exception.
  27. %% Use instead of catch, to avoid building a stacktrace unnecessarily.
  28. -define(MAY_FAIL(Expr), try (Expr) catch _:_ -> '$caught_exception' end).