<commit_before>(function(fm, $, ng, undefined) {

	fm.app.factory("fmMapMessages", function($rootScope, $templateCache, $compile) {
		return function(map) {
			var scope = $rootScope.$new(true);
			scope.messages = [ ];

			var el = $($templateCache.get("map/messages/messages.html")).insertAfter(map.map.getContainer());
			$compile(el)(scope);
			scope.$evalAsync(); // $compile only replaces variables on next digest

			return {
				showMessage : function(type, message, buttons, lifetime, onclose) {
					var messageObj = {
						type: type,
						message: message,
						buttons: buttons,
						close: function(callOnClose) {
							var idx = scope.messages.indexOf(messageObj);
							if(idx != -1)
								scope.messages = scope.messages.slice(0, idx).concat(scope.messages.slice(idx+1));

							callOnClose && onclose && onclose();

							scope.$evalAsync();
						}
					};
<commit_msg>Properly display Error objects in messages<commit_after>(function(fm, $, ng, undefined) {

	fm.app.factory("fmMapMessages", function($rootScope, $templateCache, $compile) {
		return function(map) {
			var scope = $rootScope.$new(true);
			scope.messages = [ ];

			var el = $($templateCache.get("map/messages/messages.html")).insertAfter(map.map.getContainer());
			$compile(el)(scope);
			scope.$evalAsync(); // $compile only replaces variables on next digest

			return {
				showMessage : function(type, message, buttons, lifetime, onclose) {
					var messageObj = {
						type: type,
						message: message instanceof Error ? message.name + ": " + message.message : message,
						buttons: buttons,
						close: function(callOnClose) {
							var idx = scope.messages.indexOf(messageObj);
							if(idx != -1)
								scope.messages = scope.messages.slice(0, idx).concat(scope.messages.slice(idx+1));

							callOnClose && onclose && onclose();

							scope.$evalAsync();
						}
					};

{'fraction_non_alphanumeric': 0.1506342494714588, 'fraction_numerical': 0.003171247357293869, 'mean_word_length': 3.371824480369515, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5815212', 'n_tokens_mistral': 723, 'n_tokens_neox': 554, 'n_words': 118}