2012-03-21

juan_gandhi: (Default)
2012-03-21 03:13 pm

ну какая у нас на джаве монада... да вот, exception

        try {
            require(iAmOk, getClass().getSimpleName() + " is not properly initialized");
            require(msg instanceof Message.BlaBlaBlaRequest, "wrong request type " + msg.getClass().getSimpleName());

            Message.BlaBlaBlaRequest rq = (Message.BlaBlaBlaRequest) msg;
            require(rq.thing_id != null && !rq.thing_id.isEmpty(), "thing id missing");
            
            byte[] bytes = someone.getThing(rq.thing_id);
            require(bytes != null && bytes.length > 0, "thing not found");
            
            return Message.l2map(hashmap("thing", (Message) Message.blob(bytes))); // casting due to broken variance in Java
        } catch (Failure f) {
            return f.report();
        } catch (Exception e) {
            return error(e);
        }

juan_gandhi: (Default)
2012-03-21 06:31 pm

"и никаких не читайте"

ruvru:"Большой взрыв, в результате которого образовалась Вселенная, произошел в результате действия законов физики, и для него не нужно было вмешательство Бога. К такому выводу пришел известный американский физик Стивен Хокинг..."