summaryrefslogtreecommitdiff
path: root/js/src/Ice/ExUtil.js
blob: 635393bf0e79a8f67f4788c77996056214b12e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

var Ice = require("../Ice/LocalException").Ice;

//
// Local aliases.
//
var UnexpectedObjectException = Ice.UnexpectedObjectException;
var MemoryLimitException = Ice.MemoryLimitException;

//
// Exception utilities
//

Ice.ExUtil =
{
    throwUOE: function(expectedType, v)
    {
        var type = v.ice_id();
        throw new UnexpectedObjectException("expected element of type `" + expectedType + "' but received '" +
                                            type, type, expectedType);
    },
    throwMemoryLimitException: function(requested, maximum)
    {
        throw new MemoryLimitException("requested " + requested + " bytes, maximum allowed is " + maximum +
                                       " bytes (see Ice.MessageSizeMax)");
    }
};
module.exports.Ice = Ice;