1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1999-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22
23%% To able to generate nice crash reports we need a catch on the highest level.
24%% This code can't be purged so a code change is not possible.
25%% And hence this a simple module.
26
27-module(mnesia_sp).
28
29-export([init_proc/4]).
30
31init_proc(Who, Mod, Fun, Args) ->
32    mnesia_lib:verbose("~p starting: ~p~n", [Who, self()]),
33    try
34        apply(Mod, Fun, Args)
35    catch
36        exit:Reason when Reason =:= shutdown; Reason =:= kill; Reason =:= normal ->
37            mnesia_monitor:terminate_proc(Who, Reason, Args),
38	    exit(Reason);
39        _:Reason:ST ->
40	    mnesia_monitor:terminate_proc(Who, {Reason,ST}, Args),
41	    exit(Reason)
42    end.
43
44
45
46
47