package ppx_platform

  1. Overview
  2. Docs

Source file ppx_platform.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
exception Melange_only of string

let fail_melange_only name =
  if Printexc.backtrace_status () then
    Printf.eprintf
      {|'%s' is melange_only and ran in the native build. Call it only from Melange code: inside let%%melange_only, [%%melange_only ...] or the Melange branch of match%%platform.

Call stack:
%s
%!|}
      name
      (Printexc.raw_backtrace_to_string (Printexc.get_callstack 8));
  raise (Melange_only name)